Variable
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | √ |
| Atlas inference products | √ |
| Atlas training products | √ |
Function Description
Creates a variable tensor. The Variable operator assigns a value through the input x, and records the value of the variable tensor internally. The output y is the created variable tensor. The InferShape function returns success but does not explicitly set the output description, which is inferred by the framework by default (the output follows the input).
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | The input tensor used to assign a value to the variable tensor. The caller does not need to pass the value of the variable tensor. | TensorType::ALL() | ND |
| index | Attribute | The index of the input tensor. | Int, with the default value of 0 | - |
| value | Attribute | Used to pass and record the value of the variable tensor. | Tensor, with the default value of Tensor() | - |
| container | Attribute | The container of the variable tensor. | String, with the default value of "" | - |
| shared_name | Attribute | The shared name of the variable tensor. | String, with the default value of "" | - |
| y | Output | The created variable tensor. | TensorType::ALL() | ND |
Constraint Description
None
Invocation Description
The Variable operator is a basic graph engine operator. It is usually used as a variable node in a graph, and is not invoked separately.
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| Graph-mode invocation | test_geir_variable | Invokes the Variable operator by building a graph through the operator IR. |