CalcDataSizeByShape

Description

Calculates the memory size (in bytes) of a tensor based on the tensor shape.

Prototype

int64_t CalcDataSizeByShape() const

Parameters

None

Returns

An uint64_t for the memory size, in bytes.

  • If the return value is greater than or equal to 0, the operation is successful.
  • If the return value is less than 0, the operation fails.

Restrictions

None

Example

uint64_t size = tensor->CalcDataSizeByShape();