Public Member Functions | |
StorageImpl (caffe2::TypeMeta data_type, int64_t numel, at::DataPtr data_ptr, at::Allocator *allocator, bool resizable) | |
StorageImpl (caffe2::TypeMeta data_type, int64_t numel, at::Allocator *allocator, bool resizable) | |
StorageImpl & | operator= (StorageImpl &&other)=default |
StorageImpl & | operator= (const StorageImpl &)=delete |
StorageImpl (StorageImpl &&other)=default | |
StorageImpl (const StorageImpl &)=delete | |
void | reset () |
template<typename T > | |
bool | IsType () const |
template<typename T > | |
T * | data () const |
template<typename T > | |
T * | unsafe_data () const |
void | release_resources () override |
This is called when refcount reaches zero. More... | |
size_t | itemsize () const |
size_t | capacity () const |
int64_t | numel () const |
void | set_numel (int64_t numel) |
bool | resizable () const |
at::DataPtr & | data_ptr () |
const at::DataPtr & | data_ptr () const |
at::DataPtr | set_data_ptr (at::DataPtr &&data_ptr) |
void | set_dtype (const caffe2::TypeMeta &data_type) |
void * | data () |
void * | data () const |
at::DeviceType | device_type () const |
at::Allocator * | allocator () |
const caffe2::TypeMeta & | dtype () const |
const at::Allocator * | allocator () const |
void | set_allocator (at::Allocator *allocator) |
Device | device () const |
void | set_resizable (bool resizable) |
void | UniqueStorageShareExternalPointer (void *src, const caffe2::TypeMeta &data_type, size_t capacity, DeleterFnPtr d=nullptr) |
Can only be called when use_count is 1. | |
void | UniqueStorageShareExternalPointer (at::DataPtr &&data_ptr, const caffe2::TypeMeta &data_type, size_t capacity) |
Can only be called when use_count is 1. | |
Additional Inherited Members | |
Protected Member Functions inherited from c10::intrusive_ptr_target | |
intrusive_ptr_target (intrusive_ptr_target &&other) noexcept | |
intrusive_ptr_target & | operator= (intrusive_ptr_target &&other) noexcept |
intrusive_ptr_target (const intrusive_ptr_target &other) noexcept | |
intrusive_ptr_target & | operator= (const intrusive_ptr_target &other) noexcept |
Definition at line 10 of file StorageImpl.h.
|
inlineoverridevirtual |
This is called when refcount reaches zero.
You can override this to release expensive resources. There might still be weak references, so your object might not get destructed yet, but you can assume the object isn't used anymore, i.e. no more calls to methods or accesses to members (we just can't destruct it yet because we need the weakcount accessible).
Even if there are no weak references (i.e. your class is about to be destructed), this function is guaranteed to be called first. However, if you use your class for an object on the stack that is destructed by the scope (i.e. without intrusive_ptr), this function will not be called.
Reimplemented from c10::intrusive_ptr_target.
Definition at line 82 of file StorageImpl.h.