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

Function _save_selected_rows

python/paddle/framework/io.py:735–751  ·  view source on GitHub ↗
(selected_rows, file_name)

Source from the content-addressed store, hash-verified

733
734
735def _save_selected_rows(selected_rows, file_name):
736 if not selected_rows.get_tensor()._is_initialized():
737 raise ValueError("The saved tensor is not initialized.")
738 if _is_file_path(file_name):
739 # '_seek' is the end position of this SelectedRows in the file.
740 _seek = core.save_selected_rows(selected_rows, file_name)
741
742 elif _is_memory_buffer(file_name):
743 selected_rows_bytes = core.save_selected_rows_to_memory(selected_rows)
744 with _open_file_buffer(file_name, 'wb') as f:
745 f.write(selected_rows_bytes)
746 _seek = f.tell()
747 else:
748 raise NotImplementedError(
749 f'Only supports saving objects to file or BytesIO, but received {type(file_name)}'
750 )
751 return _seek
752
753
754def _load_selected_rows(file_name):

Callers 1

_save_binary_varFunction · 0.85

Calls 8

ValueErrorClass · 0.85
_is_file_pathFunction · 0.85
_is_memory_bufferFunction · 0.85
_open_file_bufferFunction · 0.85
NotImplementedErrorClass · 0.85
typeFunction · 0.50
get_tensorMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected