Open
Conversation
drahnr
reviewed
Feb 1, 2023
| "Input Shape Mismatch\nExpected {:?}\nActual {:?}", | ||
| reshaped_shape, old_shape | ||
| ); | ||
| if reshaped_shape[1..] == old_shape[1..] { |
Member
There was a problem hiding this comment.
I think it'd make more sense to add an assert per dimension, and just fail with the first.
for dim in 0..5 {
let old = old_shape[dim];
let reshaped = reshaped__shape[dim];
assert_eq!(old, reshpaed, "Dimension {dim} mismatches {old} != {reshaped}");
}
unreachable!("If the total size is not equal, one dimension mismatch must exist. qed");
Contributor
Author
There was a problem hiding this comment.
I did it this way to catch some errors with mismatched batch sizes to make it a bit more clear.
Member
There was a problem hiding this comment.
I think it should always show the full dimensions as well. That way it stays clear where it could originate from your code. These errors can arise from rather deep inside the code.
Contributor
Author
There was a problem hiding this comment.
I believe that my recent commit should have done this.
drahnr
reviewed
Feb 1, 2023
| for layer in &self.layers { | ||
| if layer.borrow().input_blob_names.len() < input_data.len() { | ||
| panic!("Layer {} expected {} input(s) but got {}.", layer.borrow().name, layer.borrow().input_blob_names.len(), input_data.len()); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR accomplish?
Makes error messages more readable
Closes #182 .
Changes proposed by this PR:
This replaces some operations that can fail with better error messages
Notes to reviewer:
Unsure of how to test this per se, since it is based on errors.
I don't know all the places it could go wrong, so I need help with identification.
📜 Checklist
juice-examplesrun just fine