1#ifndef ATEN_CORE_TENSOR_BUFFER_H_
2#define ATEN_CORE_TENSOR_BUFFER_H_
95 return reinterpret_cast<T*
>(
data());
An abstract base class for memory allocators.
Definition allocator.h:17
The base class for reference-counted objects.
Definition refcount.h:14
Interface to access the raw ref-counted data buffer.
Definition tensor_buffer.h:13
DeviceType GetDeviceType() const
Get the type of device used by the TensorBuffer.
Definition tensor_buffer.cpp:77
~TensorBuffer()
Destroy the TensorBuffer object.
Definition tensor_buffer.cpp:44
TensorBuffer & operator=(const TensorBuffer &other)
Assignment operator overload for the TensorBuffer class.
Definition tensor_buffer.cpp:98
int64_t allocated_bytes_
The number of bytes allocated for this buffer.
Definition tensor_buffer.h:142
TensorBuffer * root_buffer()
Get the root TensorBuffer object.
Definition tensor_buffer.cpp:66
void * data() const
Get the raw data pointer.
Definition tensor_buffer.cpp:54
void * data_
Pointer to the underlying data buffer.
Definition tensor_buffer.h:140
bool owns_memory_
Bool to indicate whether this tensor owns it's memory.
Definition tensor_buffer.h:141
void resize(size_t size)
resize the tensor buffer
Definition tensor_buffer.cpp:84
T * base() const
Reinterpret the buffer as an array of type T.
Definition tensor_buffer.h:94
base::core::Allocator * allocator() const
Get the Allocator object used in this class.
Definition tensor_buffer.cpp:69
base::core::Allocator * alloc_
Pointer to the allocator used for memory allocation.
Definition tensor_buffer.h:139
size_t GetAllocatedBytes() const
Get the size of the buffer.
Definition tensor_buffer.cpp:59
virtual bool OwnsMemory() const
Check whether this TensorBuffer owns the underlying memory.
Definition tensor_buffer.cpp:74
#define T
Definition exp.cpp:237
DeviceType
The type of memory used by an allocator.
Definition tensor_types.h:73
This file contains the definition of the DataType enum class.