Fix undefined behavior in tf.raw_ops.Switch
in eager mode.
PiperOrigin-RevId: 332584498 Change-Id: I5637f3a978e97315928aac2fffd1956bd356773b
This commit is contained in:
parent
24a77523d1
commit
42afb8a459
@ -308,12 +308,7 @@ Status KernelAndDeviceOp::Run(
|
||||
if (outputs != nullptr) {
|
||||
outputs->clear();
|
||||
for (int i = 0; i < context.num_outputs(); ++i) {
|
||||
const auto* output_tensor = context.mutable_output(i);
|
||||
if (output_tensor != nullptr) {
|
||||
outputs->push_back(Tensor(*output_tensor));
|
||||
} else {
|
||||
outputs->push_back(Tensor());
|
||||
}
|
||||
outputs->push_back(Tensor(*context.mutable_output(i)));
|
||||
}
|
||||
}
|
||||
return Status::OK();
|
||||
|
@ -4579,14 +4579,6 @@ class ControlFlowTest(test.TestCase, parameterized.TestCase):
|
||||
result = control_flow_ops.merge([v_f, v_t])
|
||||
self.evaluate(result)
|
||||
|
||||
def testSwitchEagerMode(self):
|
||||
if not context.executing_eagerly():
|
||||
return
|
||||
input_data = [1, 2, 3, 4]
|
||||
vf, vt = control_flow_ops.switch(input_data, False)
|
||||
self.assertAllEqual(vf, input_data)
|
||||
self.assertAllEqual(vt, [])
|
||||
|
||||
@test_util.run_deprecated_v1
|
||||
def testQIntArgAndRet(self):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user