DestroyTemporaryVariable
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
Destroys a temporary variable and returns its final value. All other uses of the temporary variable must be executed before this operator. This operator is used in pairs with the TemporaryVariable operator: it matches TemporaryVariable through the var_name attribute, reads the final value of the temporary variable, and triggers the destruction. The shape and data type of the output tensor y are consistent with those of the input tensor x.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Reference to the temporary variable tensor. | TensorType::ALL() | ND |
| var_name | Attribute | Optional. Name of the temporary variable, which must be the same as the var_name attribute of the TemporaryVariable operator. | String, with the default value "" | - |
| y | Output | Final value of the temporary variable tensor, whose shape and data type are consistent with those of the input x. | TensorType::ALL() | ND |
Constraint Description
- This operator is an experimental feature (EXPERIMENTAL) and must not be used in production environments.
- This operator is a TensorFlow-compatible operator. The graph engine registers it as a node that should be eliminated in the graph optimization phase (GeDeletedOp): in real TensorFlow graphs, the framework parser pairs it with TemporaryVariable and eliminates it during the parsing phase (after var_name matching, this node is deleted and consumers are directly connected). Therefore, this operator cannot be compiled and executed independently through RunGraph/BuildModel.
Invocation Description
The DestroyTemporaryVariable operator is a basic operator of the graph engine and is used in pairs with the TemporaryVariable operator: TemporaryVariable creates a temporary variable for downstream writing, and this operator reads the final value and destroys the temporary variable after all uses are complete.
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| Graph-mode invocation | test_geir_destroy_temporary_variable | Invokes the DestroyTemporaryVariable operator by building a graph through the operator IR |