-
-
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
reducedim allocates array of incorrect eltype #26709
Comments
Agreed; I don't see why |
Spent a little time digging into this, though I think I'm in over my head at this point. The check for As far as I can tell, the Tr = isconcretetype(T) ? typeof(z) : T |
For the curious, this line comes from a generalization of a method which worked only for |
Fixed by #28089 |
Indeed, thanks for the fix @nalimilan |
To compute the
eltype
of the array storing the result,reducedim
doesjulia/base/reducedim.jl
Line 119 in bce5bbe
I don't understand the reasoning behind the condition
typeof(z) == typeof(x) && !isbits(T)
. Why not just doTr = typeof(z)
?Here is a MWE:
The reduction fails because
Tr
isVariable
instead ofAffExpr
.typeof(z)
andtypeof(x)
areAffExpr
andisbits(Variable)
isfalse
.The text was updated successfully, but these errors were encountered: