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

Method add_tensor_info

convert.py:903–908  ·  view source on GitHub ↗
(self, name: str, tensor: LazyTensor)

Source from the content-addressed store, hash-verified

901 svocab.add_to_gguf(self.gguf)
902
903 def add_tensor_info(self, name: str, tensor: LazyTensor) -> None:
904 n_elements = int(np.prod(tensor.shape))
905 raw_dtype = getattr(tensor.data_type, 'ggml_type', None)
906 data_type = getattr(tensor.data_type, 'quantized_type', None) or tensor.data_type.dtype
907 data_nbytes = tensor.data_type.elements_to_bytes(n_elements)
908 self.gguf.add_tensor_info(name, tensor.shape, data_type, data_nbytes, raw_dtype = raw_dtype)
909
910 def write_meta(self) -> None:
911 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