TensorVariable.reshape(shape, ndim=None)[source]#

Return a reshaped view/copy of this variable.

Returns a view of this Variable that has been reshaped as in numpy.reshape. If the shape is a Variable argument, then you might need to use the optional ndim parameter to declare how many elements the shape has, and therefore how many dimensions the reshaped Variable will have.

  • shape – Something that can be converted to a symbolic vector of integers.

  • ndim – The length of the shape. Passing None here means for Aesara to try and guess the length of shape.


This has a different signature than numpy’s ndarray.reshape! In numpy you do not need to wrap the shape arguments in a tuple, in aesara you do need to.