-
Notifications
You must be signed in to change notification settings - Fork 43
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
add a check for valtypename to comparedims
to be used when broadcasting
#879
base: main
Are you sure you want to change the base?
add a check for valtypename to comparedims
to be used when broadcasting
#879
Conversation
comparedims
to be used when broadcasting
Isn't this too strong? Now Which may not be what we want? |
Okay probably not. So maybe we want to check if they have the same abstract type. So if both are |
Yeah, this is probably why I didn't do it 😅 Like what does the same abstract type really mean when it's generally accepted that you can add intermediate abstract types without a breaking change. |
@@ -616,6 +622,10 @@ end | |||
isnothing(msg) || _orderaction(msg, a, b) | |||
return false | |||
end | |||
if valtypename && Base.typename(typeof(parent(a))) != Base.typename(typeof(parent(b))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could introduce a function for this check and return false as fallback and return true for combinations that assume to be comparable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a bit complicated to know what the function should do.
We may need to just manually distinguish AbstractSampled from AbstractCategorical, and let promote_dims
take care of the rest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this function could return true for identical types, or for combinations where there is some specialized implementation of promote_first
(which is I think just for both AbstractSampled
or two AbstractCategorical
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason it returns this NoLookup currently is because nothing else is implemented for promote_dims
/promote_first
(I think?), so it would make sense to kind of mirror that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Its a bit odd to have the same thing in two places... I wonder if we can somehow make it share the same code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like have this comparison dependent on the results of promote_first
Solves #878
E.g.
With the error message
ERROR: DimensionMismatch: Lookup types for Z do not match: Sampled and Categorical.