GetVariables

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

x

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/ge_api.h>
  • Library file: libge_runner.so

Function Usage

Queries variables and obtains Tensor information of all variable operators or of a specified variable operator within a Session.

Prototype

APIs taking string arguments will be deprecated in future releases. Use APIs taking non-string arguments instead.

1
2
Status GetVariables(const std::vector<std::string> &var_names, std::vector<Tensor> &var_values)
Status GetVariables(const std::vector<AscendString> &var_names, std::vector<Tensor> &var_values)

Parameters

Parameter

Input/Output

Description

var_names

Input

Name of the variable operator. If this parameter is left empty, the values of all variable operators are returned.

var_values

Output

Value of the variable operator, which is output in same format as tensor. The value must be the same as that of var_names.

Returns

Parameter

Type

Description

-

Status

SUCCESS: success.

Other values: The variable operator name does not exist. The variable is not initialized.

Restrictions

None