Class AMSTensor

Class Documentation

class AMSTensor

Public Types

using IntDimType = long int
using LifetimeToken = std::shared_ptr<void>

Public Functions

~AMSTensor() = default
AMSTensor(const AMSTensor&) = delete
AMSTensor &operator=(const AMSTensor&) = delete
AMSTensor(AMSTensor &&other) noexcept
AMSTensor &operator=(AMSTensor &&other) noexcept
inline IntDimType elements() const
inline IntDimType element_size() const
inline size_t nbytes() const
inline size_t storage_nbytes() const
inline size_t dim() const
inline AMSDType dtype() const
inline AMSResourceType location() const
inline ArrayRef<IntDimType> strides() const
inline ArrayRef<IntDimType> shape() const
inline ArrayRef<IntDimType> sizes() const
inline bool contiguous() const
inline bool writable() const
inline bool valid() const noexcept
inline LifetimeToken lifetimeToken() const
template<typename T>
inline T *data()
template<typename T>
inline const std::remove_cv_t<T> *data() const
inline void *data_ptr()
inline const void *data_ptr() const
AMSTensor transpose(IntDimType axis1 = 0, IntDimType axis2 = 1)
AMSTensor transpose(IntDimType axis1 = 0, IntDimType axis2 = 1) const
AMSTensor clone() const

Public Static Functions

template<typename ScalarType>
static AMSTensor create(ArrayRef<IntDimType> shapes, ArrayRef<IntDimType> strides, AMSResourceType location)
template<typename ScalarType>
static AMSTensor view(ScalarType *data, ArrayRef<IntDimType> shapes, ArrayRef<IntDimType> strides, AMSResourceType location)

Borrow memory. The caller remains responsible for its lifetime/capacity.

template<typename ScalarType>
static AMSTensor view(ScalarType *data, ArrayRef<IntDimType> shapes, ArrayRef<IntDimType> strides, AMSResourceType location, LifetimeToken lifetime)

View foreign memory and retain the supplied foreign-storage owner.

static AMSTensor view(AMSTensor &tensor)
static AMSTensor view(const AMSTensor &tensor)
static AMSTensor concat(ArrayRef<AMSTensor> tensors, AMSDType inputDType)