Unverified Commit 321f6552 authored by YosuaMichael's avatar YosuaMichael Committed by GitHub
Browse files

Make the assert message more verbose (#6583)

parent 24890d71
...@@ -268,8 +268,8 @@ class VisionTransformer(nn.Module): ...@@ -268,8 +268,8 @@ class VisionTransformer(nn.Module):
def _process_input(self, x: torch.Tensor) -> torch.Tensor: def _process_input(self, x: torch.Tensor) -> torch.Tensor:
n, c, h, w = x.shape n, c, h, w = x.shape
p = self.patch_size p = self.patch_size
torch._assert(h == self.image_size, "Wrong image height!") torch._assert(h == self.image_size, f"Wrong image height, expected {self.image_size} but got {h}!")
torch._assert(w == self.image_size, "Wrong image width!") torch._assert(w == self.image_size, f"Wrong image width, expected {self.image_size} but got {w}!")
n_h = h // p n_h = h // p
n_w = w // p n_w = w // p
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment