目录

Constructor

Function Description

Constructs a specified tensor object. The Tensor class is used to describe the information and behavior of a tensor object, including the shape, format, datatype, and tensor data.

Function Prototype

Tensor (const StorageShape &storage_shape, const StorageFormat &storage_format, const TensorPlacement placement, const ge::DataType data_type, TensorAddress addr)
Tensor(const StorageShape &storage_shape, const StorageFormat &storage_format, ge::DataType data_type)

Parameters

Parameter Input/Output Description
storage_shape Input Shape information of a specified tensor.
storage_format Input Format information of a specified tensor.
placement Input Location of the device where the actual tensor data is stored.
data_type Input Data type of a specified tensor.
addr Input Memory address that stores the actual tensor data.

Return Value

An initialized tensor object.

Restrictions

None

Calling Example

Tensor tensor{{{8, 3, 224, 224}, {16, 3, 224, 224}}, // shape
              {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, // format
              kOnDeviceHbm, // placement
              ge::DT_FLOAT16, // dt
              nullptr};