CreateInput

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

Function Usage

Creates an input node.

Prototype

  • Create a graph input node.
    1
    EsTensorHolder CreateInput(int64_t index,const char *name,const char *type)
    
  • Create a default input node named input_{index}. The node index starts from 0.
    1
    EsTensorHolder CreateInput(int64_t index)
    
  • Create an input node with a specified name.
    1
    EsTensorHolder CreateInput(int64_t index, const char *name)
    
  • Create an input node with complete information.
    1
    EsTensorHolder CreateInput(int64_t index, const char *name, ge::DataType data_type, ge::Format format, const std::vector<int64_t> &shape)
    

Parameters

Parameter

Input/Output

Description

index

Input

Index of the input node, starting from 0.

name

Input

Name of the input node. If the value is nullptr, the default name input_{index} is used.

type

Input

Type string of the input node. If the value is nullptr, the default value Data is used.

format

Input

Tensor format.

data_type

Input

Data type.

shape

Input

Tensor shape vector. If it is left blank, a scalar is created.

Returns

Parameter

Type

Description

-

EsTensorHolder

Created input tensor holder. If the creation fails, an invalid EsTensorHolder is returned.

Constraints

None

Examples

  • Create a graph input node.
    1
    2
    EsGraphBuilder builder("graph_name");
    auto t1 = builder.CreateInput(0, "input0", "Data");
    
  • Create a default input node named input_{index}. The node index starts from 0.
    1
    2
    EsGraphBuilder builder("graph_name");
    auto tensor = builder.CreateInput(1);
    
  • Create an input node with a specified name.
    1
    2
    EsGraphBuilder builder("graph_name");
    auto tensor = builder.CreateInput(2, "input2");
    
  • Create an input node with complete information.
    1
    2
    EsGraphBuilder builder("graph_name");
    auto tensor = builder.CreateInput(3, "input3", ge::DT_INT32, ge::FORMAT_NCHW, {2, 2});