Skip to content

Commit

Permalink
add more informative error message
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jul 15, 2021
1 parent 2aa84ee commit caa65d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions byol_pytorch/byol_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def forward(
return_embedding = False,
return_projection = True
):
assert not (self.training and x.shape[0] == 1), 'you must have greater than 1 sample when training, due to the batchnorm in the projection layer'

if return_embedding:
return self.online_encoder(x, return_projection = return_projection)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'byol-pytorch',
packages = find_packages(exclude=['examples']),
version = '0.5.6',
version = '0.5.7',
license='MIT',
description = 'Self-supervised contrastive learning made simple',
author = 'Phil Wang',
Expand Down

0 comments on commit caa65d7

Please sign in to comment.