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)
| 23 | |
| 24 | |
| 25 | def 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 | |
| 49 | def get_node_name(element_name): |
no outgoing calls
no test coverage detected