def put_const_vals(self, const_vals): """ Put const value into tensor cache. Args: const_vals (list[NamedValueProto]): List of const values. """ for const_val in const_vals: if not (const_val.value and const_val.key): continue if DataType.Name(const_val.value.dtype) == "DT_TENSOR": tensor_proto = const_val.value.tensor_val tensor_proto.node_name = const_val.key tensor_proto.slot = '0' const_tensor = OpTensor(tensor_proto) else: const_tensor = ConstTensor(const_val) self._const_vals[const_tensor.name] = const_tensor
def dtype(self): """The property of tensor dtype.""" return DataType.Name(self._const_proto.value.dtype)
def dtype(self): """The property of tensor dtype.""" tensor_type = DataType.Name(self._tensor_proto.data_type) return tensor_type