Interface to access the raw ref-counted data buffer.
More...
#include <tensor_buffer.h>
|
base::core::Allocator * | alloc_ = nullptr |
| Pointer to the allocator used for memory allocation.
|
|
void * | data_ = nullptr |
| Pointer to the underlying data buffer.
|
|
bool | owns_memory_ = false |
| Bool to indicate whether this tensor owns it's memory.
|
|
int64_t | allocated_bytes_ = 0 |
| The number of bytes allocated for this buffer.
|
|
Interface to access the raw ref-counted data buffer.
◆ TensorBuffer() [1/4]
Construct a new TensorBuffer object.
- Parameters
-
alloc | Pointer to the allocator to use for memory allocation. |
data_ptr | Pointer to the underlying data buffer. |
◆ TensorBuffer() [2/4]
◆ TensorBuffer() [3/4]
container::TensorBuffer::TensorBuffer |
( |
void * |
data_ptr | ) |
|
|
explicit |
Construct a new TensorBuffer object.
This is a reference TensorBuffer, does not owns memory itself.
- Parameters
-
data_ptr | Pointer to the given data buffer. |
◆ TensorBuffer() [4/4]
container::TensorBuffer::TensorBuffer |
( |
TensorBuffer && |
other | ) |
|
|
noexcept |
Move constructor for the TensorBuffer class.
This constructor is used to move the contents and ownership of another TensorBuffer object into the newly created object using move semantics. The source TensorBuffer's resources will be taken over, and the source object will be left in a valid but unspecified state.
- Parameters
-
other | The rvalue reference to the source TensorBuffer object to be moved. |
- Note
- This function is declared as noexcept, indicating that it does not throw exceptions.
◆ ~TensorBuffer()
container::TensorBuffer::~TensorBuffer |
( |
| ) |
|
◆ allocator()
Get the Allocator object used in this class.
- Returns
- Allocator* Pointer to the Allocator object.
◆ base()
T * container::TensorBuffer::base |
( |
| ) |
const |
|
inline |
Reinterpret the buffer as an array of type T.
- Template Parameters
-
T | The type to reinterpret the buffer as. |
- Returns
- T* Pointer to the underlying buffer reinterpreted as type T.
◆ data()
void * container::TensorBuffer::data |
( |
| ) |
const |
Get the raw data pointer.
- Returns
- void* Pointer to the underlying data buffer.
◆ GetAllocatedBytes()
size_t container::TensorBuffer::GetAllocatedBytes |
( |
| ) |
const |
Get the size of the buffer.
- Returns
- size_t The size of the buffer in bytes.
◆ GetDeviceType()
DeviceType container::TensorBuffer::GetDeviceType |
( |
| ) |
const |
◆ operator=() [1/2]
Assignment operator overload for the TensorBuffer class.
This operator is used to assign the values of another TensorBuffer object to the current object. It performs a deep copy of the data from the source TensorBuffer to the destination TensorBuffer.
- Parameters
-
other | The source TensorBuffer object whose values will be assigned. |
- Returns
- A reference to the current TensorBuffer object after the assignment.
◆ operator=() [2/2]
Move assignment operator overload for the TensorBuffer class.
This operator is used to move the contents and ownership of another TensorBuffer object into the current object using move semantics. The source TensorBuffer's resources will be taken over, and the source object will be left in a valid but unspecified state.
- Parameters
-
other | The rvalue reference to the source TensorBuffer object to be moved. |
- Returns
- A reference to the current TensorBuffer object after the move assignment.
- Note
- This function is declared as noexcept, indicating that it does not throw exceptions.
◆ OwnsMemory()
bool container::TensorBuffer::OwnsMemory |
( |
| ) |
const |
|
virtual |
Check whether this TensorBuffer owns the underlying memory.
- Returns
- true If the TensorBuffer owns the underlying memory.
-
false If the TensorBuffer does not own the underlying memory.
◆ resize()
void container::TensorBuffer::resize |
( |
size_t |
size | ) |
|
◆ root_buffer()
◆ alloc_
Pointer to the allocator used for memory allocation.
◆ allocated_bytes_
int64_t container::TensorBuffer::allocated_bytes_ = 0 |
|
private |
The number of bytes allocated for this buffer.
◆ data_
void* container::TensorBuffer::data_ = nullptr |
|
private |
Pointer to the underlying data buffer.
◆ owns_memory_
bool container::TensorBuffer::owns_memory_ = false |
|
private |
Bool to indicate whether this tensor owns it's memory.
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_base/module_container/ATen/core/tensor_buffer.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_base/module_container/ATen/core/tensor_buffer.cpp