aesara.tensor.as_tensor#
- aesara.tensor.as_tensor(x: Union[Variable, Sequence[Variable], ArrayLike], name: Optional[str] = None, ndim: Optional[int] = None, **kwargs) TensorVariable[source]#
Convert
xinto an equivalentTensorVariable.This function can be used to turn ndarrays, numbers,
ScalarTypeinstances,Applyinstances andTensorVariableinstances into valid input list elements.See
aesara.as_symbolicfor a more general conversion function.- Parameters:
x – The object to be converted into a
Variabletype. Anumpy.ndarrayargument will not be copied, but a list of numbers will be copied to make annumpy.ndarray.name – If a new
Variableinstance is created, it will be named with this string.ndim – Return a
Variablewith this many dimensions.dtype – The dtype to use for the resulting
Variable. Ifxis already aVariabletype, then the dtype will not be changed.
- Raises:
TypeError – If
xcannot be converted to aTensorVariable.