MCPcopy Create free account
hub / github.com/pytorch/pytorch / _open_file_like

Function _open_file_like

torch/serialization.py:443–452  ·  view source on GitHub ↗
(name_or_buffer, mode)

Source from the content-addressed store, hash-verified

441
442
443def _open_file_like(name_or_buffer, mode):
444 if _is_path(name_or_buffer):
445 return _open_file(name_or_buffer, mode)
446 else:
447 if 'w' in mode:
448 return _open_buffer_writer(name_or_buffer)
449 elif 'r' in mode:
450 return _open_buffer_reader(name_or_buffer)
451 else:
452 raise RuntimeError(f"Expected 'r' or 'w' in mode but got {mode}")
453
454
455class _open_zipfile_reader(_opener):

Callers 2

saveFunction · 0.85
loadFunction · 0.85

Calls 4

_is_pathFunction · 0.85
_open_fileClass · 0.85
_open_buffer_writerClass · 0.85
_open_buffer_readerClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…