MCPcopy Create free account
hub / github.com/XiaoMi/mace / get_data_bytes

Method get_data_bytes

tools/python/micro/scratch_computer.py:77–92  ·  view source on GitHub ↗
(self, data_type)

Source from the content-addressed store, hash-verified

75 return arg.i
76
77 def get_data_bytes(self, data_type):
78 if data_type == mace_pb2.DT_FLOAT or \
79 data_type == mace_pb2.DT_INT32:
80 return 4
81 elif data_type == mace_pb2.DT_HALF or \
82 data_type == mace_pb2.DT_BFLOAT16 or \
83 data_type == mace_pb2.DT_FLOAT16:
84 return 2
85 elif data_type == mace_pb2.DT_UINT8:
86 return 1
87 elif data_type == mace_pb2.DT_INT16:
88 return 2
89 elif data_type == mace_pb2.DT_INT8:
90 return 1
91 else:
92 mace_check(False, "Invalid data type: %s" % data_type)
93
94 def scratch_size_conv(self, op_def):
95 if (ModelKeys.quantize in self.model_conf

Calls 1

mace_checkFunction · 0.90

Tested by

no test coverage detected