Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Member Functions
c10::StorageImpl Struct Referencefinal
Inheritance diagram for c10::StorageImpl:
c10::intrusive_ptr_target

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)
 
StorageImploperator= (StorageImpl &&other)=default
 
StorageImploperator= (const StorageImpl &)=delete
 
 StorageImpl (StorageImpl &&other)=default
 
 StorageImpl (const StorageImpl &)=delete
 
void reset ()
 
template<typename T >
bool IsType () const
 
template<typename T >
Tdata () const
 
template<typename T >
Tunsafe_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::DataPtrdata_ptr ()
 
const at::DataPtrdata_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::Allocatorallocator ()
 
const caffe2::TypeMetadtype () const
 
const at::Allocatorallocator () 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_targetoperator= (intrusive_ptr_target &&other) noexcept
 
 intrusive_ptr_target (const intrusive_ptr_target &other) noexcept
 
intrusive_ptr_targetoperator= (const intrusive_ptr_target &other) noexcept
 

Detailed Description

Definition at line 10 of file StorageImpl.h.

Member Function Documentation

void c10::StorageImpl::release_resources ( )
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.


The documentation for this struct was generated from the following file: