aesara.tensor.as_tensor#
- aesara.tensor.as_tensor(x: Variable | Sequence[Variable] | ArrayLike, name: str | None = None, ndim: int | None = None, **kwargs) TensorVariable [source]#
Convert
x
into an equivalentTensorVariable
.This function can be used to turn ndarrays, numbers,
ScalarType
instances,Apply
instances andTensorVariable
instances into valid input list elements.See
aesara.as_symbolic
for a more general conversion function.- Parameters:
x – The object to be converted into a
Variable
type. Anumpy.ndarray
argument will not be copied, but a list of numbers will be copied to make annumpy.ndarray
.name – If a new
Variable
instance is created, it will be named with this string.ndim – Return a
Variable
with this many dimensions.dtype – The dtype to use for the resulting
Variable
. Ifx
is already aVariable
type, then the dtype will not be changed.
- Raises:
TypeError – If
x
cannot be converted to aTensorVariable
.