-
Notifications
You must be signed in to change notification settings - Fork 47
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
Unification of shape checks #250
Comments
Is this really completed? |
Errr, wrong issue. |
At the same time, I am not sure if there is something to unify here? I think checking for shapes should be done per module, as they can provide better error messages within their context? |
Could be the case. My idea was to have several functions for the cases that keep repeating, e.g. if |
The problem is that the error message ends up being generic: "expected tensors to have matching leading dimensions" while today we can say "expected the data to have the same dimension as the query" etc. We actually had those helpers inside Nx itself at the beginning but we removed them because of that once we introduced |
I am not sure whether this comment is fully on-topic, but on linear models, I find the behaviour of the api to be inconsistent when it comes to data shapes. You can fit all linear models with a target shaped The models yielding this error are:
The models not yielding this error are:
A livebook showcasing this behaviour of linear models is available here. I think all linear models should work fine with |
Sure, that is really strange behaviour and not supposed to happen, so feel free to work on it. I'll appreciate that :) |
I've taken a further look at the issue with linear models. I think there is a decision to be made on how to handle the situation:
Meaning, A different approach would be, shape-check the target, and make sure to flatten it prior to fitting the model. This would ensure that
I mathematically favor the second option, when linear models are described mathematically, the target is a column vector and actually fitting a column vector and a vector should yield the same results. Looking forward to your comments. |
I think that we may try the second direction, and if it will introduce some breaking changes to |
As mentioned here.
The text was updated successfully, but these errors were encountered: