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

Function _load_selected_rows

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

Source from the content-addressed store, hash-verified

752
753
754def _load_selected_rows(file_name):
755 temp_sr = core.SelectedRows()
756 if _is_file_path(file_name):
757 # '_seek' is the end position of this SelectedRows in the file.
758 _seek = core.load_selected_rows(temp_sr, file_name)
759
760 elif _is_memory_buffer(file_name):
761 with _open_file_buffer(file_name, 'rb') as f:
762 selected_rows_bytes = f.read()
763 paddle.base.core.load_selected_rows_from_memory(
764 temp_sr, selected_rows_bytes
765 )
766 _seek = f.tell()
767
768 else:
769 raise NotImplementedError(
770 f'Only supports load objects from file or BytesIO, but received {type(file_name)}'
771 )
772
773 return temp_sr, _seek
774
775
776def _save_binary_var(obj, path):

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
SelectedRowsMethod · 0.80
typeFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected