pymc.math.flatten#

pymc.math.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
xpytensor.tensor.var.TensorVariable

The variable to be reshaped.

ndimint

The number of dimensions of the returned variable The default value is 1.

Returns
pytensor.tensor.var.TensorVariable

the flattened variable with dimensionality of outdim