FilesLast commitLast update
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
28 days ago
15 days ago
README

VarHandleOp

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 handle to a variable resource. The output tensor y is a scalar resource handle (DT_RESOURCE type). The shape and dtype attributes describe the shape and data type of the variable that the handle points to (rather than the shape of the output itself), for use by downstream resource operators (such as ReadVariableOp and AssignVariableOp). The container and shared_name attributes specify the container and shared name of the variable.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
container Attribute Optional. The container where the variable is located. String, with the default value of "" -
shared_name Attribute Optional. The shared name of the variable. String, with the default value of "" -
dtype Attribute Required. The data type of elements in the variable that the handle points to. Type -
shape Attribute Optional. The shape of the variable that the handle points to. ListInt, with the default value of UNKNOWN_SHAPE -
y Output A scalar resource handle (DT_RESOURCE type). TensorType({DT_RESOURCE}) ND

Constraint Description

  • This operator is an experimental feature (EXPERIMENTAL). Do not use it in the production environment.
  • This operator is a resource handle source node. Its output is a scalar DT_RESOURCE tensor, which has no runtime computation semantics. This operator cannot be executed independently through RunGraph/BuildModel.
  • The shape/dtype attributes describe the shape and type of the variable that the handle points to (not the shape and type of the output itself). During inference, they are passed to downstream resource operators through the HandleShapesAndTypes mechanism of InferenceContext (framework peer propagation), and downstream operators read them through GetInputHandleShapesAndTypes.

Invocation Description

The VarHandleOp operator is a basic graph engine operator. It serves as a resource handle source node and works with downstream resource operators (such as ReadVariableOp and AssignVariableOp). It is not invoked separately.

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_var_handle_op Invokes the VarHandleOp operator by building a graph through the operator IR.