Converts an array or a variable into
This is a convenient function to get a
Variableobject transparently from a raw array or a variable.
Note that this function should only be used for type consistency (i.e., to enforce the return value of an API having type
requires_gradflag is kept as is; if
objis a raw array, the newly created variable has
requires_grad = False. In order to make a variable w.r.t. which you want to compute the gradient, you should use
- Return type