(file_name)
| 713 | |
| 714 | |
| 715 | def _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 | |
| 735 | def _save_selected_rows(selected_rows, file_name): |
no test coverage detected