Tensor-Puzzles icon indicating copy to clipboard operation
Tensor-Puzzles copied to clipboard

Add error message for shape mismatch

Open xavierforge opened this issue 2 years ago • 2 comments

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])

xavierforge avatar Mar 08 '23 03:03 xavierforge

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

srush avatar Mar 08 '23 20:03 srush

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

xavierforge avatar Apr 28 '23 15:04 xavierforge