SetDataType

Description

Sets the data type of a tensor.

Prototype

void SetDataType(const ge::DataType data_type)

Parameters

Parameter

Input/Output

Description

data_type

Input

Data type of a tensor to be set.

For details about the definition of ge::DataType, see DataType.

Returns

None

Restrictions

None

Example

StorageShape sh({1, 2, 3}, {1, 2, 3});
Tensor t = {sh, {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, kOnHost, ge::DT_FLOAT, nullptr};
t.SetDataType(ge::DT_DOUBLE);