Here's an amazing fact about Numpy. Don't fall into this trap!pic.twitter.com/7I64zLEfSN
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
Saw similar thing recently in another context, better to explicitly reshape instead of relying on broadcasting rules.
Yeah, definitely learned this the hard way when assessing the accuracy of a ML model ensemble. The way it was composed, one of the models returned predictions in the shape (N, 1). I was wondering why the error was larger than I expected when things looked good visually.
Looks like NumPy does its broadcast-matching from back to front, so y's 32 matches with x's 1, and... welp. Sometimes make me nervous that batch sizes and feature dims are often powers of 2, and such errors can be very invisible, especially with a big reduce op at the end.
When unit testing models I always set the sizes of everything to prime numbers for this reason. It's the closest thing to reasonable typechecking available.
I don't know what's meant to be the trap here. Python is such an awful mess of random behaviour but the broadcasting rules are one area where you can successfully reason about Python code algebraically
I was surprised to find that broadcasting could make an array smaller. But it makes perfect algebraic sense. (Don't look at attached screenshot if you want to set yourself this as a puzzle :)pic.twitter.com/9mTMVplg6z
Lol, but how 2048?
that implies the existence of reasonable broadcasting operations :-)
Allowing trailing comma is way more trouble than the occasional convenience it buys.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.