Generate all broadcast-able shapes from a given shape in numpy

Viewed 42

I have an array shape

eg - (10, 3)

I am looking for a function in numpy that can generate all possible shapes having at least 1 dimension, that can broadcast with the given shape.

output eg - [(1,), (3,), (1, 1), (1, 3), (10, 1), (10, 3)]

I know this can be done with python loops but I am looking for a better solution in numpy.

0 Answers
Related