Removes the device assignment code from a tensor. e.g. _tensor_name_base("foo:3") => "foo" Args: full_tensor_name: A tensor name that is annotated with a device placement (this is what tensor flow introspection gives). Returns: A name without any device assignment.
(full_tensor_name)
| 876 | |
| 877 | |
| 878 | def _tensor_name_base(full_tensor_name): |
| 879 | """Removes the device assignment code from a tensor. |
| 880 | |
| 881 | e.g. _tensor_name_base("foo:3") => "foo" |
| 882 | |
| 883 | Args: |
| 884 | full_tensor_name: A tensor name that is annotated with a device placement |
| 885 | (this is what tensor flow introspection gives). |
| 886 | Returns: |
| 887 | A name without any device assignment. |
| 888 | """ |
| 889 | if full_tensor_name.startswith("^"): |
| 890 | return full_tensor_name[1:] |
| 891 | return full_tensor_name.split(":")[0] |
| 892 | |
| 893 | |
| 894 | def _tensorflow_output_name(tensor_name, output_index): |
no test coverage detected