1#ifndef FREE_TENSOR_ARRAY_H
2#define FREE_TENSOR_ARRAY_H
46 std::vector<ArrayCopy> ptrs_;
50 std::optional<ArrayCopy> tempPtr_;
52 size_t size_ = 0, nElem_ = 0;
53 std::vector<size_t> shape_;
55 bool dontDropBorrow_, moved_;
100 size_t size()
const {
return size_; }
101 size_t nElem()
const {
return nElem_; }
102 const std::vector<size_t> &
shape()
const {
return shape_; }
108 bool moved()
const {
return moved_; }
size_t size() const
Definition: array.h:100
void makePrivateCopy()
Definition: array.cc:353
void * rawInitTo(const Ref< Device > &device)
Definition: array.cc:305
void * rawTemporarilyCopiedTo(const Ref< Device > &device)
Definition: array.cc:338
Array & operator=(const Array &)=delete
void setDontDropBorrow(bool flag)
Definition: array.h:106
void setMoved(bool flag)
Definition: array.h:109
bool dontDropBorrow() const
Definition: array.h:105
size_t nElem() const
Definition: array.h:101
Array(const Array &)=delete
void * rawMovedTo(const Ref< Device > &device)
Definition: array.cc:255
DataType dtype() const
Definition: array.h:103
const std::vector< size_t > & shape() const
Definition: array.h:102
~Array()
Definition: array.cc:185
void * rawSharedTo(const Ref< Device > &device)
Definition: array.cc:227
bool moved() const
Definition: array.h:108
Array & operator=(Array &&)
Definition: array.cc:212
static Array borrowFromRaw(void *ptr, const std::vector< size_t > &shape, DataType dtype, const Ref< Device > &device, bool dontDropBorrow, bool moved)
Definition: array.cc:177
static Array moveFromRaw(void *ptr, const std::vector< size_t > &shape, DataType dtype, const Ref< Device > &device)
Definition: array.cc:170
Definition: data_type.h:106
Definition: allocator.h:9
bool borrowed_
Definition: array.h:18
uint8_t * ptr_
Definition: array.h:17
ArrayCopy(const Ref< Device > &device, uint8_t *ptr, bool borrowed)
Definition: array.h:20
Ref< Device > device_
Definition: array.h:16