Skip to content
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 error message for shape mismatch #18

Closed
wants to merge 2 commits into from
Closed

Add error message for shape mismatch #18

wants to merge 2 commits into from

Conversation

eatPizza311
Copy link

Address for #14 , catch the shape mismatch before PyTorch throws RuntimeError.
Returns an error message as below:

AssertionError: Two tensors have a different shapes
 Spec: 
	Expect: torch.Size([5]) 
	Got: torch.Size([1, 5])

@srush
Copy link
Owner

srush commented Mar 8, 2023

Sorry, this unfortunately breaks broadcasting. You could try catching the runtime error.

@eatPizza311
Copy link
Author

Sorry, I didn't notice this would break broadcasting.
I've changed the assertion only for this particular runtime error.

@eatPizza311 eatPizza311 closed this by deleting the head repository Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants