-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make 3x broadcasting #19537
Comments
This isn't legal. |
what does that mean? |
And we pick the dot syntax exactly because we don't want to and cannot do this. (Not at parser level and hard in optimization) |
what other way is there to interpret number*array? |
You don't know that it's number * array. |
There are a lot of times when you do. I am only asking for an optimization when the number is a literal in the code and the variable is in a function and has type info known. |
You never know this at syntax level which is when the "translation" (lowering) happens. Therefore, it's a very hard optimization in inference that doesn't worth doing anymore. |
And I said it's not worth doing since it's harder to implement, less reliable (effectively bring back the issue of having a set of blessed vectorized functions and not being able to extend the set) and we (will soon) have a more reliable alternative and doing this will encourage people to write code in the wrong way. |
For the context of
|
does something bad happen if we broadcast multiplication onto scalars? If not, it seems to me that we could just say |
It always works like that and it has nothing to do with fusion. |
Also new broadcast methods for sparse et al. Should remove most of the objections raised then. |
... OK. sure. I'm not really sure if it's a good idea (it is indeed a distinct syntax but it's less explicit that the user actually want broadcasting/fusion) but that should be possible to implement. The mentioning of "array vs scalar" at all in the original post was very confusing.... |
I think we opted not to do this. The |
I agree that this makes little sense, especially in light of the decision to make linear algebra the default. |
One of the really nice things about julia is the way you can write expressions in ways that look like regular math (eg
x=3y+5z
). This currently gets turned intox=3*y+5*z
. This is great when y and z are scalar, but when they are array's, it would make more sense for this to be translated tox=3.*y+5.*z
. This would allow everything to be fused, and in general look nicer.The text was updated successfully, but these errors were encountered: