EsSetDataType

Applicability

Product

Supported or Not

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/esb_funcs.h>
  • Library files: libeager_style_graph_builder_base.so and libeager_style_graph_builder_base_static.a

Function Usage

Sets the data type of a tensor. If no data type is specified, the default value float is used.

Prototype

1
uint32_t EsSetDataType(EsCTensorHolder *tensor, C_DataType data_type)

Parameters

Parameter

Input/Output

Description

tensor

Input

Pointer to the tensor holder.

data_type

Input

Data type.

Returns

Parameter

Type

Description

-

uint32_t

0: success; other values: failure

Constraints

None

Examples

1
2
3
4
5
/ 1. Create a graph builder (EsCGraphBuilder).
EsCGraphBuilder *builder = EsCreateGraphBuilder("graph_name");
// 2. Add a start node.
EsCTensorHolder *data0 = EsCreateInput(builder, 0); // Add input node 0. The default data type is FLOAT.
EsSetDataType(data0, C_DT_INT32); // Set the data type of input node 0.