MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / test

Method test

tensorflow/python/framework/ops_test.py:930–953  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

928 if forward_compat.forward_compatible(2019, 8, 23):
929 @eager_function.defun
930 def test():
931 output = control_flow_ops.while_loop(lambda x: x < 3, lambda x: x + 1,
932 [1])
933 while_op = output.op
934 self.assertEqual(while_op.type, "StatelessWhile")
935 orig_num_inputs = len(while_op.inputs)
936
937 # Make sure we can handle the while op having a control input.
938 while_op._add_control_input(constant_op.constant(0).op)
939
940 new_input1 = constant_op.constant(1.0)
941 new_input2 = constant_op.constant(True)
942
943 # Clear output shapes to bypass shape checking.
944 while_op._set_shape_list_attr("output_shapes", [])
945 while_op._set_type_list_attr("T",
946 [t.dtype for t in while_op.inputs] +
947 [new_input1.dtype, new_input2.dtype])
948
949 while_op._add_while_inputs([new_input1, new_input2])
950 # Can't add an edge beyond what's specified by "T"
951 with self.assertRaises(errors.OutOfRangeError):
952 while_op._add_while_inputs([new_input2])
953 self.assertEqual(len(while_op.inputs), orig_num_inputs + 2) # pylint: disable=g-deprecated-assert
954
955 test()
956

Callers

nothing calls this directly

Calls 6

_add_control_inputMethod · 0.80
_set_shape_list_attrMethod · 0.80
_set_type_list_attrMethod · 0.80
_add_while_inputsMethod · 0.80
while_loopMethod · 0.45
constantMethod · 0.45

Tested by

no test coverage detected