Class TensorShape

Class Documentation

class TensorShape

Public Functions

TensorShape()

Constructs a TensorShape and returns a handle to it.

Returns

the handle to the created TensorShape

TensorShape(const TensorShape &other)

Copy constructor.

Parameters

other[in] object to copy.

Returns

the handle to the created TensorShape.

TensorShape(TensorShape &&other) noexcept
TensorShape(std::initializer_list<Dimension> dims)

Creates a new shape with a list of dims specified in array.

Parameters

dims[in] The dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

Returns

the handle to the created TensorShape

TensorShape &operator=(const TensorShape &other) noexcept

Assigns the contents of this handle into other handle.

Parameters

other – Destination TensorShape handle

Returns

SNPE_SUCCESS on successful Assignment

TensorShape &operator=(TensorShape &&other) noexcept
TensorShape(const size_t *dims, size_t size)

Creates a new shape with a list of dims specified in array.

Parameters
  • dims[in] The dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

  • size[in] Size of the array.

Returns

the handle to the created TensorShape

TensorShape(const std::vector<size_t> &dims)
void concatenate(const size_t *dims, size_t size)

Concatenates additional dimensions specified in the array to the existing dimensions.

Parameters
  • dims[in] The dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

  • size[in] Size of the array.

void concatenate(const size_t &dim)

Concatenates additional dimensions specified in the array to the existing dimensions.

Parameters
  • dims[in] The dimensions are specified in which the last element of the vector represents the fastest varying dimension and the zeroth element represents the slowest varying, etc.

  • size[in] Size of the array.

size_t operator[](size_t idx) const

Gets dimension at index idx.

Parameters

idx[in] : Position in the dimension array.

Returns

The dimension value in tensor shape

DimensionReference operator[](size_t idx)

Gets dimension at index idx.

Parameters

idx[in] : Position in the dimension array.

Returns

The dimension value in tensor shape

size_t rank() const

Retrieves the rank i.e. number of dimensions.

Returns

The rank

const size_t *getDimensions() const

Retrieves a pointer to the first dimension of shape.

Returns

nullptr if no dimension exists; otherwise, points to the first dimension.

Protected Static Attributes

static constexpr DeleteFunctionType DeleteFunction = {Snpe_TensorShape_Delete}