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

Function parse_node_or_tensor_name

tensorflow/python/debug/lib/debug_graphs.py:25–46  ·  view source on GitHub ↗

Get the node name from a string that can be node or tensor name. Args: name: An input node name (e.g., "node_a") or tensor name (e.g., "node_a:0"), as a str. Returns: 1) The node name, as a str. If the input name is a tensor name, i.e., consists of a colon, the final colon

(name)

Source from the content-addressed store, hash-verified

23
24
25def parse_node_or_tensor_name(name):
26 """Get the node name from a string that can be node or tensor name.
27
28 Args:
29 name: An input node name (e.g., "node_a") or tensor name (e.g.,
30 "node_a:0"), as a str.
31
32 Returns:
33 1) The node name, as a str. If the input name is a tensor name, i.e.,
34 consists of a colon, the final colon and the following output slot
35 will be stripped.
36 2) If the input name is a tensor name, the output slot, as an int. If
37 the input name is not a tensor name, None.
38 """
39
40 if ":" in name and not name.endswith(":"):
41 node_name = name[:name.rfind(":")]
42 output_slot = int(name[name.rfind(":") + 1:])
43
44 return node_name, output_slot
45 else:
46 return name, None
47
48
49def get_node_name(element_name):

Callers 2

get_node_nameFunction · 0.85
get_output_slotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected