MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / add_tensor_info

Method add_tensor_info

convert-dense.py:870–875  ·  view source on GitHub ↗
(self, name: str, tensor: LazyTensor)

Source from the content-addressed store, hash-verified

868 svocab.add_to_gguf(self.gguf)
869
870 def add_tensor_info(self, name: str, tensor: LazyTensor) -> None:
871 n_elements = int(np.prod(tensor.shape))
872 raw_dtype = getattr(tensor.data_type, 'ggml_type', None)
873 data_type = getattr(tensor.data_type, 'quantized_type', None) or tensor.data_type.dtype
874 data_nbytes = tensor.data_type.elements_to_bytes(n_elements)
875 self.gguf.add_tensor_info(name, tensor.shape, data_type, data_nbytes, raw_dtype = raw_dtype)
876
877 def write_meta(self) -> None:
878 self.gguf.write_header_to_file()

Callers 1

write_allMethod · 0.95

Calls 1

elements_to_bytesMethod · 0.45

Tested by

no test coverage detected