Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Feb 20, 2021
1 parent e3205c0 commit 05edfff
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions vit_pytorch/vit_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from einops import rearrange, repeat
from einops.layers.torch import Rearrange

MIN_NUM_PATCHES = 16

class Residual(nn.Module):
def __init__(self, fn):
super().__init__()
Expand Down Expand Up @@ -92,7 +90,6 @@ def __init__(self, *, image_size, patch_size, num_classes, dim, depth, heads, ml
assert image_size % patch_size == 0, 'Image dimensions must be divisible by the patch size.'
num_patches = (image_size // patch_size) ** 2
patch_dim = channels * patch_size ** 2
assert num_patches > MIN_NUM_PATCHES, f'your number of patches ({num_patches}) is way too small for attention to be effective (at least 16). Try decreasing your patch size'
assert pool in {'cls', 'mean'}, 'pool type must be either cls (cls token) or mean (mean pooling)'

self.to_patch_embedding = nn.Sequential(
Expand Down

0 comments on commit 05edfff

Please sign in to comment.