aesara.tensor.flatten

Contents

aesara.tensor.flatten#

aesara.tensor.flatten(x, ndim=1)[source]#

Return a copy of the array collapsed into one dimension.

Reshapes the variable x by keeping the first outdim-1 dimension size(s) of x the same, and making the last dimension size of x equal to the multiplication of its remaining dimension size(s).

Parameters:
  • x (aesara.tensor.var.TensorVariable) – The variable to be reshaped.

  • ndim (int) – The number of dimensions of the returned variable The default value is 1.

Returns:

the flattened variable with dimensionality of outdim

Return type:

aesara.tensor.var.TensorVariable