Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update forward method of BYOL #90

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update forward method of BYOL
just a minor edit in the forward method of BYOL.
  • Loading branch information
akashsonowal authored Apr 19, 2023
commit 59462ed0e98f5ff4941aa93fe2937c54a46e488b
3 changes: 2 additions & 1 deletion byol_pytorch/byol_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ def forward(
x,
return_embedding = False,
return_projection = True
training = 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'
assert not (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