Struct TensorObject

struct TensorObject

Handle for interacting with Morpheus Tensor objects. Typically constructed using the Tensor::create factory method.

Public Functions

TensorObject() = default

inline TensorObject(std::shared_ptr<MemoryDescriptor> md, std::shared_ptr<ITensor> tensor)

inline TensorObject(std::shared_ptr<ITensor> tensor)

TensorObject(const TensorObject &other) = default

inline TensorObject(TensorObject &&other)

~TensorObject() = default

inline void *data() const

inline DType dtype() const

inline TensorSize count() const

inline TensorSize bytes() const

inline RankType rank() const

inline TensorSize dtype_size() const

inline ShapeType get_shape() const

inline ShapeType get_stride() const

inline TensorIndex shape(TensorIndex idx) const

inline TensorIndex stride(TensorIndex idx) const

inline intptr_t stream() const

inline bool is_compact() const

inline TensorObject slice(ShapeType min_dims, ShapeType max_dims) const

inline TensorObject reshape(const ShapeType &dims) const

inline TensorObject deep_copy() const

template<typename T = uint8_t>
inline std::vector<T> get_host_data() const

template<typename T, RankType N>
inline T read_element(const TensorIndex (&idx)[N]) const

template<typename T, RankType N>
inline T read_element(const std::array<TensorIndex, N> idx) const

inline TensorObject &swap(TensorObject &&other) noexcept

Explicitly swap the pointers to the underlying data with another tensor. Use inplace of the move operator since it’s hard to determine when you want to perform a move vs copy the data.

Returns

TensorObject&

inline TensorObject &operator=(const TensorObject &other)

inline std::shared_ptr<ITensor> get_tensor() const

inline std::shared_ptr<MemoryDescriptor> get_memory() const

inline std::string get_numpy_typestr() const

inline TensorObject as_type(DType dtype) const

inline TensorObject copy_rows(const std::vector<RangeType> &selected_rows, TensorIndex num_rows) const

Creates a deep copy of the rows specified in the exclusive ranges of vector<pair<start, stop>> of the stop row.

Parameters
  • selected_rows

  • num_rows

Returns

TensorObject

Protected Functions

void throw_on_invalid_storage()

Friends

inline friend void swap(TensorObject &lhs, TensorObject &rhs) noexcept

Swap this tensor with another. Only the pointers to the enderlying data are exchanged. No values are moved.

Previous Struct TensorModelMapping
Next Struct TensorObjectInterfaceProxy
© Copyright 2024, NVIDIA. Last updated on Apr 25, 2024.