aesara.tensor.squeeze#
- aesara.tensor.squeeze(x, axis=None)[source]#
Remove broadcastable (length 1) dimensions from the shape of an array.
It returns the input array, but with the broadcastable dimensions removed. This is always
x
itself or a view intox
.New in version 0.6.
- Parameters:
x – Input data, tensor variable.
axis (None or int or tuple of ints, optional) – Selects a subset of broadcastable dimensions to be removed. If a non broadcastable dimension is selected, an error is raised. If
axis
isNone
, all broadcastable dimensions will be removed.
Notes
- The behavior can differ from that of NumPy in two ways:
1. If an axis is chosen for a dimension that is not known to be broadcastable an error is raised, even if this dimension would be broadcastable when the variable is evaluated. 2. Similarly, if
axis
isNone
, only dimensions known to be broadcastable will be removed, even if there are more dimensions that happen to be broadcastable when the variable is evaluated.
- Return type:
x
withoutaxis
dimensions.