GetVariables
Description
Queries variables and obtains the tensors of all variable operators or tensor a specified variable operator in a Session.
Prototype
APIs using strings will be deprecated in later versions. Use APIs supporting non-string data instead.
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, or the variable is not initialized. |
Restrictions
None
Parent topic: Graph Running APIs