Ops with no outputs in eager should return None instead of []
PiperOrigin-RevId: 175983704
This commit is contained in:
parent
de8453ff5d
commit
b20d11d36c
@ -30,6 +30,7 @@ from tensorflow.python.framework import tensor_shape
|
||||
from tensorflow.python.framework import test_util
|
||||
from tensorflow.python.layers import core
|
||||
from tensorflow.python.ops import array_ops
|
||||
from tensorflow.python.ops import control_flow_ops
|
||||
from tensorflow.python.ops import math_ops
|
||||
from tensorflow.python.ops import random_ops
|
||||
from tensorflow.python.ops import sparse_ops
|
||||
@ -349,6 +350,9 @@ class OpsTest(test_util.TensorFlowTestCase):
|
||||
x = constant_op.constant(3.1415)
|
||||
self.assertEqual('3.14', '{:.2f}'.format(x))
|
||||
|
||||
def testNoOpIsNone(self):
|
||||
self.assertTrue(control_flow_ops.no_op() is None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test.main()
|
||||
|
||||
@ -531,6 +531,8 @@ string GenEagerPythonOp::Code() {
|
||||
strings::StrAppend(&result_, " _result = _", op_def_.name(),
|
||||
"Output._make(_result)\n");
|
||||
}
|
||||
} else {
|
||||
strings::StrAppend(&result_, " _result = None\n");
|
||||
}
|
||||
strings::StrAppend(&result_, " return _result\n\n");
|
||||
return prelude_ + result_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user