xref: /aosp_15_r20/external/pytorch/torch/csrc/serialization.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #ifndef THP_SERIALIZATION_INC
2 #define THP_SERIALIZATION_INC
3 
4 #include <c10/core/StorageImpl.h>
5 #include <c10/util/intrusive_ptr.h>
6 template <class io>
7 void doRead(io fildes, void* buf, size_t nbytes);
8 
9 template <class io>
10 void doWrite(io fildes, void* buf, size_t nbytes);
11 
12 // Note that this takes a mutable storage because it may pass through
13 // to at::from_blob.
14 template <class io>
15 void THPStorage_writeFileRaw(
16     c10::StorageImpl* self,
17     io fd,
18     bool save_size,
19     uint64_t element_size);
20 
21 template <class io>
22 c10::intrusive_ptr<c10::StorageImpl> THPStorage_readFileRaw(
23     io fd,
24     c10::intrusive_ptr<c10::StorageImpl> storage,
25     uint64_t element_size);
26 
27 #endif
28