mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[package] implement get_resource_reader
API (#51674)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/51674 See https://docs.python.org/3/library/importlib.html#importlib.abc.ResourceReader Test Plan: Imported from OSS Reviewed By: zdevito Differential Revision: D26237034 Pulled By: suo fbshipit-source-id: 4c19f6172d16b710737528d3de48372873b9368d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bfc80b3566
commit
b4d8f4af82
@ -991,6 +991,11 @@ void initJITBindings(PyObject* module) {
|
||||
std::tie(data, size) = self.getRecord(key);
|
||||
return py::bytes(reinterpret_cast<const char*>(data.get()), size);
|
||||
})
|
||||
.def(
|
||||
"has_record",
|
||||
[](PyTorchStreamReader& self, const std::string& key) {
|
||||
return self.hasRecord(key);
|
||||
})
|
||||
.def(
|
||||
"get_storage_from_record",
|
||||
[](PyTorchStreamReader& self,
|
||||
|
Reference in New Issue
Block a user