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

Method testNodeDefArgs

tensorflow/python/framework/ops_test.py:1218–1243  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1216class ApplyOpTest(test_util.TensorFlowTestCase):
1217
1218 def testNodeDefArgs(self):
1219 g = ops.Graph()
1220 t1 = _apply_op(g, "FloatOutput", [], [dtypes.float32], name="myop1")
1221 with g.device("/device:GPU:0"):
1222 t2 = _apply_op(
1223 g, "TwoIntOutputs", [], [dtypes.int32, dtypes.int32], name="myop2")
1224 t3 = _apply_op(
1225 g,
1226 "Foo1", [t1, t2[1], t2[0]], [dtypes.float32, dtypes.int32],
1227 name="myop3")
1228 self.assertTrue(isinstance(t1, ops.Tensor))
1229 self.assertTrue(isinstance(t2, list))
1230 self.assertTrue(isinstance(t3, list))
1231 self.assertTrue(isinstance(t3[0], ops.Tensor))
1232 self.assertEqual("myop1", t1._as_node_def_input())
1233 self.assertEqual("myop2", t2[0]._as_node_def_input())
1234 self.assertEqual("myop2:1", t2[1]._as_node_def_input())
1235 self.assertEqual("myop3", t3[0]._as_node_def_input())
1236 # Validate that we got the right ops as well
1237 self.assertProtoEquals("name:'myop1' op:'FloatOutput'", t1.op.node_def)
1238 self.assertProtoEquals(
1239 "name:'myop2' op:'TwoIntOutputs' device:'/device:GPU:0'",
1240 t2[0].op.node_def)
1241 self.assertProtoEquals(
1242 "name:'myop3' input:'myop1' input:'myop2:1' input:'myop2' op:'Foo1'",
1243 t3[0].op.node_def)
1244
1245 def testReferenceInput(self):
1246 g = ops.Graph()

Callers

nothing calls this directly

Calls 5

deviceMethod · 0.95
_apply_opFunction · 0.85
assertProtoEqualsMethod · 0.80
GraphMethod · 0.45
_as_node_def_inputMethod · 0.45

Tested by

no test coverage detected