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

Method scratch_size_conv

tools/python/micro/scratch_computer.py:94–112  ·  view source on GitHub ↗
(self, op_def)

Source from the content-addressed store, hash-verified

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
96 and self.model_conf[ModelKeys.quantize] == 1):
97 output_channels = op_def.output_shape[0].dims[3]
98 cmsis_bias_bytes = \
99 self.get_data_bytes(mace_pb2.DT_INT32) * output_channels
100
101 input_dims = self.get_op_input_dims(op_def, 0)
102 filter_dims = self.get_op_input_dims(op_def, 1)
103 cmsis_nn_buffer_bytes = \
104 2 \
105 * input_dims[3] \
106 * filter_dims[2] \
107 * filter_dims[1] \
108 * self.get_data_bytes(mace_pb2.DT_INT16)
109
110 return cmsis_nn_buffer_bytes + cmsis_bias_bytes
111 else:
112 return 0
113
114 def scratch_size_of_expand_dims(self, op_def):
115 output_dim_size = len(op_def.output_shape[0].dims)

Callers

nothing calls this directly

Calls 2

get_data_bytesMethod · 0.95
get_op_input_dimsMethod · 0.95

Tested by

no test coverage detected