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:97
~TensorBuffer()
Destroy the TensorBuffer object.
Definition tensor_buffer.cpp:50
TensorBuffer(base::core::Allocator *alloc, void *data_ptr)
Construct a new TensorBuffer object.
Definition tensor_buffer.cpp:13
TensorBuffer & operator=(const TensorBuffer &other)
Assignment operator overload for the TensorBuffer class.
Definition tensor_buffer.cpp:122
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:79
void * data() const
Get the raw data pointer.
Definition tensor_buffer.cpp:63
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:106
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:85
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:71
virtual bool OwnsMemory() const
Check whether this TensorBuffer owns the underlying memory.
Definition tensor_buffer.cpp:91
#define T
Definition exp.cpp:237
DeviceType
Definition tensor_enums.h:28
This file contains the definition of the DataType enum class.