24 #include <glog/logging.h>
26 #include <dlpack/dlpack.h>
55 void SetSizes(DLTensor& t,
const std::vector<int64_t>& sizes);
56 void SetStrides(DLTensor& t,
const std::vector<int64_t>& strides);
60 const std::vector<int64_t>& sizes);
63 const std::vector<DLTensorUPtr>& uptrs);
64 std::vector<const DLTensor*>
constPtrs(
const std::vector<DLTensor*>& ptrs);
72 bool operator==(
const DLDataType& t1,
const DLDataType& t2);
73 std::string
toString(
const DLDataType& t);
74 std::ostream&
operator<<(std::ostream& os,
const DLTensor& t);
75 std::ostream&
operator<<(std::ostream& os,
const DLDataType& t);
79 template <
typename T,
typename TT>
81 const std::vector<T*>& v1,
82 const std::vector<TT*>& v2);
void SetSizes(DLTensor &t, const std::vector< int64_t > &sizes)
Definition: dlpack-inl.h:96
bool operator==(const DLDataType &t1, const DLDataType &t2)
Definition: dlpack-inl.h:210
std::vector< const DLTensor * > extractRawPtrs(const std::vector< DLTensorUPtr > &uptrs)
Definition: dlpack-inl.h:136
bool compareDLTensorMetadata(const DLTensor &t1, const DLTensor &t2)
Definition: dlpack-inl.h:219
std::shared_ptr< DLTensor > DLTensorSPtr
Definition: dlpack.h:51
std::ostream & operator<<(std::ostream &os, const DLDataType &t)
Definition: dlpack-inl.h:214
std::string toString(const DLDataType &t)
Definition: dlpack-inl.h:21
bool compareDLTensorVectorMetadata(const std::vector< T * > &v1, const std::vector< TT * > &v2)
Definition: dlpack-inl.h:242
std::vector< const DLTensor * > constPtrs(const std::vector< DLTensor * > &ptrs)
Definition: dlpack-inl.h:146
void operator()(DLTensor *t)
Definition: dlpack.h:41
DLTensorUPtr makeDLTensorWithSizes(DLContext ctx, DLDataType dtype, const std::vector< int64_t > &sizes)
Definition: dlpack-inl.h:118
DLContext getCPUDLContext()
Definition: dlpack-inl.h:59
DLDataType getDLDataType()
std::unique_ptr< DLTensor, DLTensorDeleter > DLTensorUPtr
Definition: dlpack.h:52
void SetStridesFromSizes(DLTensor &t, const std::vector< int64_t > &)
Definition: dlpack-inl.h:110
DLContext getGPUDLContext(int device_id)
Definition: dlpack-inl.h:68
std::vector< DLTensorUPtr > makeDLTensorVector(const std::vector< T * > &ptrs)
Definition: dlpack-inl.h:181
DLTensorUPtr makeDLTensor(const DLTensor *ptr)
Definition: dlpack-inl.h:156
void SetStrides(DLTensor &t, const std::vector< int64_t > &strides)
Definition: dlpack-inl.h:103