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

Method load

convert.py:680–687  ·  view source on GitHub ↗
(offset: int, elm_count: int)

Source from the content-addressed store, hash-verified

678 info = self.zip_file.getinfo(filename)
679
680 def load(offset: int, elm_count: int) -> NDArray:
681 dtype = data_type.dtype
682 fp = self.zip_file.open(info)
683 fp.seek(offset * dtype.itemsize)
684 size = elm_count * dtype.itemsize
685 data = fp.read(size)
686 assert len(data) == size
687 return np.frombuffer(data, dtype)
688 description = f'storage data_type={data_type} path-in-zip={filename} path={self.zip_file.filename}'
689 return LazyStorage(load=load, kind=pid[1], description=description)
690

Callers 1

lazy_load_torch_fileFunction · 0.95

Calls 6

reshapeMethod · 0.80
UnquantizedTensorClass · 0.70
openMethod · 0.45
seekMethod · 0.45
readMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected