def register(self, module: _torch.nn.Module, override_compression_type: bool = False):
        """
        Register compression metadata as buffers in module's state_dict,
        In case of joint compression, compression_type metadata is appended to module's existing compression type, if any.
        If ``override_compression_type`` flag is set, module's existing compression type metadata is overridden.
        """
        for metadata, value in self.as_dict().items():
            if metadata == "param_name" or value is None:
                continue
            buffer_name = self._get_metadata_buffer_name(metadata)

            # Handle chaining of compression types
            if metadata == "compression_type" and not override_compression_type:
                try:
                    current_value = module.get_buffer(buffer_name)
                    value = current_value.tolist() + value
                except AttributeError:
                    # Previous value doesn't exist
                    pass

            # Wrap value as a tensor to register as a buffer in module state_dict
            if not _torch.is_tensor(value):
                value = _torch.tensor(value)

            module.register_buffer(buffer_name, value)

        Register compression metadata as buffers in module's state_dict,
        In case of joint compression, compression_type metadata is appended to module's existing compression type, if any.
        If ``override_compression_type`` flag is set, module's existing compression type metadata is overridden.
        
coremltools/optimize/torch/_utils/metadata_utils.py