Struct TensorObject#
Defined in File tensor_object.hpp
Struct Documentation#
-
struct TensorObject#
Handle for interacting with Morpheus
Tensor
objects. Typically constructed using theTensor::create
factory method.Public Functions
-
TensorObject() = default#
- std::shared_ptr<MemoryDescriptor> md,
- std::shared_ptr<ITensor> tensor
-
TensorObject(const TensorObject &other) = default#
-
inline TensorObject(TensorObject &&other)#
-
~TensorObject() = default#
-
inline void *data() const#
-
inline TensorSize count() const#
-
inline TensorSize bytes() const#
-
inline TensorSize dtype_size() 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( ) const#
-
inline TensorObject reshape(const ShapeType &dims) const#
-
inline TensorObject deep_copy() const#
-
template<typename T, RankType N>
inline T read_element( - const TensorIndex (&idx)[N]
-
template<typename T, RankType N>
inline T read_element( - const std::array<TensorIndex, N> idx
-
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:
-
inline TensorObject &operator=(const TensorObject &other)#
-
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
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:
Protected Functions
-
void throw_on_invalid_storage()#
Friends
- inline friend void swap(
- TensorObject &lhs,
- TensorObject &rhs
Swap this tensor with another. Only the pointers to the enderlying data are exchanged. No values are moved.
-
TensorObject() = default#