MCPcopy
hub / github.com/OpenPPL/ppq / store_parameter_value

Method store_parameter_value

ppq/IR/quantize.py:113–122  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

111 return self
112
113 def store_parameter_value(self):
114 for var, _ in zip(self.inputs + self.outputs,
115 self.config.input_quantization_config + self.config.output_quantization_config):
116 if var.is_parameter:
117 assert isinstance(var, QuantableVariable), 'Unexpected error.'
118 # convert var.value to torch.Tensor
119 # notice here we set device = None, this conversion will not change var.value.device anyway.
120 # so that we can use var.value.device as a deploy device for stored_value
121 var.stored_value = convert_any_to_torch_tensor(var.value, device='cpu').clone()
122 return self
123
124 def dequantize(self, parameter_only: bool = False, expire_device: str = 'cpu'):
125 if self._dequantized: return self

Callers 4

quantize_operationMethod · 0.95
optimizeMethod · 0.80
optimizeMethod · 0.80
store_parameterMethod · 0.80

Calls 1

Tested by

no test coverage detected