nip.utils.maths.is_broadcastable

nip.utils.maths.is_broadcastable#

nip.utils.maths.is_broadcastable(shape_1: tuple, shape_2: tuple) bool[source]#

Check if two shapes are broadcastable.

Two shapes are broadcastable if when they are aligned from the right, corresponding dimensions are either equal or one of them is 1.

Parameters:
  • shape_1 (tuple) – The shape of the first array.

  • shape_2 (tuple) – The shape of the second array.

Returns:

is_broadcastable (bool) – True if the shapes are broadcastable, False otherwise.