MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _load_dense_tensor

Function _load_dense_tensor

python/paddle/framework/io.py:715–732  ·  view source on GitHub ↗
(file_name)

Source from the content-addressed store, hash-verified

713
714
715def _load_dense_tensor(file_name):
716 temp_t = paddle.base.core.DenseTensor()
717 if _is_file_path(file_name):
718 # '_seek' is the end position of this tensor in the file.
719 _seek = paddle.base.core.load_dense_tensor(temp_t, file_name)
720
721 elif _is_memory_buffer(file_name):
722 with _open_file_buffer(file_name, 'rb') as f:
723 tensor_bytes = f.read()
724 paddle.base.core.load_dense_tensor_from_memory(temp_t, tensor_bytes)
725 _seek = f.tell()
726
727 else:
728 raise NotImplementedError(
729 f'Only supports load objects from file or BytesIO, but received {type(file_name)}'
730 )
731
732 return temp_t, _seek
733
734
735def _save_selected_rows(selected_rows, file_name):

Callers 1

loadFunction · 0.85

Calls 7

_is_file_pathFunction · 0.85
_is_memory_bufferFunction · 0.85
_open_file_bufferFunction · 0.85
NotImplementedErrorClass · 0.85
typeFunction · 0.50
DenseTensorMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected