def GetTensors(self, tf_tensors_index):
return_list = list()
for tensor_idx in tf_tensors_index:
+ if (tensor_idx < 0):
+ return_list.append(Tensor(tensor_idx, 0, 0))
+ continue
tf_tensor = self.tf_subgraph.Tensors(tensor_idx)
buffer_idx = tf_tensor.Buffer()
tf_buffer = self.tf_model.Buffers(buffer_idx)
self.tf_buffer = tf_buffer
def PrintInfo(self, depth_str=""):
- buffer_idx = self.tf_tensor.Buffer()
- isEmpty = "Filled"
- if (self.tf_buffer.DataLength() == 0):
- isEmpty = " Empty"
- shape_str = self.GetShapeString()
- type_name = TensorTypeList[self.tf_tensor.Type()]
-
- shape_name = ""
- if self.tf_tensor.Name() != 0:
- shape_name = self.tf_tensor.Name()
-
- print_str = "Tensor {0:4} : buffer {1:4} | {2} | {3:7} | Shape {4} ({5})".format(
- self.tensor_idx, buffer_idx, isEmpty, type_name, shape_str, shape_name)
+ print_str = ""
+ if self.tensor_idx < 0:
+ print_str = "Tensor {0:4}".format(self.tensor_idx)
+ else:
+ buffer_idx = self.tf_tensor.Buffer()
+ isEmpty = "Filled"
+ if (self.tf_buffer.DataLength() == 0):
+ isEmpty = " Empty"
+ shape_str = self.GetShapeString()
+ type_name = TensorTypeList[self.tf_tensor.Type()]
+
+ shape_name = ""
+ if self.tf_tensor.Name() != 0:
+ shape_name = self.tf_tensor.Name()
+
+ print_str = "Tensor {0:4} : buffer {1:4} | {2} | {3:7} | Shape {4} ({5})".format(
+ self.tensor_idx, buffer_idx, isEmpty, type_name, shape_str, shape_name)
print(depth_str + print_str)
def GetShapeString(self):