clone#

Clone one or more dimensions of an operator to a higher rank

template<int Rank, typename Op>
auto __MATX_INLINE__ matx::clone(Op t, const index_t (&shape)[Rank])#
template<std::size_t Rank, typename Op>
auto __MATX_INLINE__ matx::clone(Op t, const std::array<index_t, Rank> &shape)#

Operator to clone an operator or tensor acorss dimensions.

Template Parameters:
  • Rank – the rank of the cloned operator

  • T – source operator/tensor type

Parameters:
  • t – source operator/tensor

  • shape

    the shape of the cloned operator/tensor.

    Each element is either the size of the cloned dimension or matxKeepDim to be from the source tensor

Returns:

operator to compute the cloned value

Examples#

auto tiv = make_tensor<TestType>({});
auto tov = make_tensor<TestType>({N,M,K});

tiv() = 3;

// Clone "tiv" from a 1D tensor to a 3D tensor
auto op = clone<3>(tiv, {N, M, K});