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

Function get_tensor_name

tensorflow/lite/python/util.py:68–86  ·  view source on GitHub ↗

Returns name of the input tensor. Args: tensor: tf.Tensor Returns: str

(tensor)

Source from the content-addressed store, hash-verified

66
67
68def get_tensor_name(tensor):
69 """Returns name of the input tensor.
70
71 Args:
72 tensor: tf.Tensor
73
74 Returns:
75 str
76 """
77 parts = tensor.name.split(":")
78 if len(parts) > 2:
79 raise ValueError("Tensor name invalid. Expect 0 or 1 colon, got {0}".format(
80 len(parts) - 1))
81
82 # To be consistent with the tensor naming scheme in tensorflow, we need
83 # drop the ':0' suffix for the first tensor.
84 if len(parts) > 1 and parts[1] != "0":
85 return tensor.name
86 return parts[0]
87
88
89def get_tensors_from_tensor_names(graph, tensor_names):

Callers 4

set_tensor_shapesFunction · 0.85
freeze_graphFunction · 0.85

Calls 2

splitMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected