3 ms·
Explicit internal broadcasting (by adding an axis with an explicit `indefinite` size instead of `1`) would be so much simpler to reason about. Unfortunately th
by o11c 2y ago
Explicit internal broadcasting (by adding an axis with an explicit `indefinite` size instead of `1`) would be so much simpler to reason about.
Unfortunately there is far too much existing code and python is not type-safe.
- bramblerose 2y agoYou can do this with `np.newaxis` - in the NumPy course I wrote as TA we required students to always be explicit about the axes (also in e.g. sums). It would be nice if you could disable the implicit broadcasting, but as you mention that would break so much code
- o11c 2y ago`np.newaxis` explicitly adds a `1` dimension, not an `indefinite` one.