Skip to content
Snippets Groups Projects
Commit 535b36be authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[ModelWrapper] add helper method to get ValueInfo

parent 346f7ea4
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,19 @@ class ModelWrapper:
qa.quant_parameter_tensor_names.append(dt)
qnt_annotations.append(qa)
def get_tensor_valueinfo(self, tensor_name):
"""Returns ValueInfoProto of tensor with given name, if it has one."""
graph = self._model_proto.graph
vi_names = [(x.name, x) for x in graph.input]
vi_names += [(x.name, x) for x in graph.output]
vi_names += [(x.name, x) for x in graph.value_info]
try:
vi_ind = [x[0] for x in vi_names].index(tensor_name)
vi = vi_names[vi_ind][1]
return vi
except ValueError:
return None
def get_tensor_shape(self, tensor_name):
"""Returns the shape of tensor with given name, if it has ValueInfoProto."""
graph = self._model_proto.graph
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment