def _process_graph_def(self, graph_def): for node_def in graph_def.node: if (debug_data.is_debug_node(node_def.name) and node_def.attr["gated_grpc"].b): node_name, output_slot, _, debug_op = ( debug_data.parse_debug_node_name(node_def.name)) self._gated_grpc_debug_watches.add( DebugWatch(node_name, output_slot, debug_op))
def testParseDebugNodeName_valid(self): debug_node_name_1 = "__dbg_ns_a/ns_b/node_c:1_0_DebugIdentity" (watched_node, watched_output_slot, debug_op_index, debug_op) = debug_data.parse_debug_node_name(debug_node_name_1) self.assertEqual("ns_a/ns_b/node_c", watched_node) self.assertEqual(1, watched_output_slot) self.assertEqual(0, debug_op_index) self.assertEqual("DebugIdentity", debug_op)
def testParseDebugNodeName_valid(self): debug_node_name_1 = "__dbg_ns_a/ns_b/node_c:1_0_DebugIdentity" (watched_node, watched_output_slot, debug_op_index, debug_op) = debug_data.parse_debug_node_name(debug_node_name_1) self.assertEqual("ns_a/ns_b/node_c", watched_node) self.assertEqual(1, watched_output_slot) self.assertEqual(0, debug_op_index) self.assertEqual("DebugIdentity", debug_op)
def testParseDebugNodeName_invalidWatchedTensorName(self): invalid_debug_node_name_1 = "__dbg_node1_0_DebugIdentity" with self.assertRaisesRegexp(ValueError, "Invalid tensor name in debug node name"): debug_data.parse_debug_node_name(invalid_debug_node_name_1)
def testParseDebugNodeName_missingDebugOpIndex(self): invalid_debug_node_name_1 = "__dbg_node1:0_DebugIdentity" with self.assertRaisesRegexp(ValueError, "Invalid debug node name"): debug_data.parse_debug_node_name(invalid_debug_node_name_1)
def testParseDebugNodeName_invalidPrefix(self): invalid_debug_node_name_1 = "__copy_ns_a/ns_b/node_c:1_0_DebugIdentity" with self.assertRaisesRegexp(ValueError, "Invalid prefix"): debug_data.parse_debug_node_name(invalid_debug_node_name_1)
def testParseDebugNodeName_invalidPrefix(self): invalid_debug_node_name_1 = "__copy_ns_a/ns_b/node_c:1_0_DebugIdentity" with self.assertRaisesRegexp(ValueError, "Invalid prefix"): debug_data.parse_debug_node_name(invalid_debug_node_name_1)
def testParseDebugNodeName_invalidWatchedTensorName(self): invalid_debug_node_name_1 = "__dbg_node1_0_DebugIdentity" with self.assertRaisesRegexp(ValueError, "Invalid tensor name in debug node name"): debug_data.parse_debug_node_name(invalid_debug_node_name_1)
def testParseDebugNodeName_missingDebugOpIndex(self): invalid_debug_node_name_1 = "__dbg_node1:0_DebugIdentity" with self.assertRaisesRegexp(ValueError, "Invalid debug node name"): debug_data.parse_debug_node_name(invalid_debug_node_name_1)