Skip to content

Commit 321f655

Browse files
authored
Make the assert message more verbose (#6583)
1 parent 24890d7 commit 321f655

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchvision/models/vision_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ def __init__(
268268
def _process_input(self, x: torch.Tensor) -> torch.Tensor:
269269
n, c, h, w = x.shape
270270
p = self.patch_size
271-
torch._assert(h == self.image_size, "Wrong image height!")
272-
torch._assert(w == self.image_size, "Wrong image width!")
271+
torch._assert(h == self.image_size, f"Wrong image height, expected {self.image_size} but got {h}!")
272+
torch._assert(w == self.image_size, f"Wrong image width, expected {self.image_size} but got {w}!")
273273
n_h = h // p
274274
n_w = w // p
275275

0 commit comments

Comments
 (0)