| 37 | self.input_names.append(input_info.name) |
| 38 | |
| 39 | def init_computer(self): |
| 40 | self.free_mem_list = [] |
| 41 | self.used_mem_list = [] |
| 42 | self.buffer_size = 0 |
| 43 | self.ref_counts = {} |
| 44 | for op in self.net_def.op: |
| 45 | for tensor_name in op.input: |
| 46 | if tensor_name in self.const_tensor_names or \ |
| 47 | tensor_name in self.input_names: |
| 48 | continue |
| 49 | if tensor_name not in self.ref_counts: |
| 50 | self.ref_counts[tensor_name] = 0 |
| 51 | self.ref_counts[tensor_name] += 1 |
| 52 | |
| 53 | def get_mem_size(self, op, output_shape): |
| 54 | np_data_type = self.np_data_type |