Class InferenceEngine::TensorDesc

class TensorDesc

This class defines Tensor description.

Public Functions

TensorDesc(const Precision &precision, const SizeVector &dims, const BlockingDesc &blockDesc)

The constructor creates the tensor descriptor using blocking descriptor.

Parameters
  • precision – memory precision

  • dims – memory dimensions

  • blockDesc – blocking descriptor

TensorDesc(const Precision &precision, const SizeVector &dims, Layout layout)

The constructor creates the tensor descriptor using standard layout.

Parameters
  • precision – memory precision

  • dims – memory dimensions

  • layout – memory layout

TensorDesc(const Precision &precision, Layout layout)

The constructor creates the empty tensor descriptor with precision and layout.

Parameters
  • precision – memory precision

  • layout – memory layout

TensorDesc()

The default constructor which creates empty tensor descriptor.

void reshape(const SizeVector &dims, Layout layout = Layout::ANY)

Reshapes the tensor descriptor.

Parameters
  • dims – new dimensions

  • layout – new layout if it is necessary

void reshape(const SizeVector &dims, const BlockingDesc &blockDesc)

Reshapes the tensor descriptor.

Parameters
  • dims – new dimensions

  • blockDesc – new blocking descriptor

inline SizeVector &getDims()

Returns the vector of dimensions.

Returns

dimensions

inline const SizeVector &getDims() const noexcept

Returns the constant vector of dimensions.

Returns

dimensions

void setDims(const SizeVector &dims)

Sets dimensions.

Parameters

dims – new dimensions

inline Layout getLayout() const

Returns the memory layout.

Returns

layout

void setLayout(Layout l)

Sets the layout.

Parameters

l – memory layout

inline const Precision &getPrecision() const

Returns the memory precision.

Returns

precision

inline void setPrecision(const Precision &p)

Sets the memory precision.

Parameters

p – precision

inline const BlockingDesc &getBlockingDesc() const

Returns the blocking descriptor.

Returns

blocking descriptor

bool operator==(const TensorDesc &rhs) const

The comparison operator for the TensorDesc.

Parameters

rhs – object to compare

Returns

true if objects are equal

bool operator!=(const TensorDesc &rhs) const

The comparison operator for the TensorDesc.

Parameters

rhs – object to compare

Returns

true if objects aren’t equal

size_t offset(const SizeVector &v) const

Calculates offset for the vector of dimensions.

Parameters

v – vector of dimensions

Returns

offset

size_t offset(size_t l) const

Calculates offset for the local offset.

Parameters

l – local offset

Returns

offset

Public Static Functions

static Layout getLayoutByDims(const SizeVector &dims)

Returns the standard layout for dimensions.

Parameters

dims – the vector of dimensions

Returns

the standard memory layout

static Layout getLayoutByRank(size_t rank)

Returns the standard layout for the specified tensor rank.

Parameters

rank – of the requested layout

Returns

the standard memory layout