Replies: 4 comments
-
Hi @yiheng-wang-nv , Could you please help confirm this question and provide some comments? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Hi @ptvu281 , the error means: where As shown in this line, |
Beta Was this translation helpful? Give feedback.
-
Figured out a solution. In this line, the argument parsed into the definition of contrastive loss have 'batch_size=batch_size*2'. However, in the function, the batch size has been multiplied again. The problem was fixed when I set 'batch_size=batch_size' in the definition. If it is the case, I would send a PR to fix that. |
Beta Was this translation helpful? Give feedback.
-
@Eason-Qin I think you might have caught a bug in the SSL tutorial where the batch-size being sent to CL is being multiplied by 2. I am not sure what you are implying by changing the batch size in the definition of the CL. Below is a code snippet, which will work with all batch-sizes. I would request you to share what code you are trying even if it's a snippet and what batch-size were you setting, so that we can further understand the need for the PR that you are requesting. @yiheng-wang-nv is right, that both of these need to match up as to what he wrote earlier. The cause for multiplication by 2 within the CL loss function itself is implementation purposes.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Discussed in #581
Originally posted by ptvu281 February 27, 2022
I'm trying to adapt the self-supervision tutorial for a 2D case. However, I keep getting a tensor shape mismatch error at the contrastive loss step. I've posted a screenshot of the error here: https://imgur.com/a/AXmWKgB
Looking at the source code, I see that the error could be caused by the shape mismatch between
negatives_mask
andsim_matrix
but I'm not sure how to proceed. The things I have changed to adapt for 2D are:end_dim=4
toend_dim=3
img_size
andpatch_size
to a 2-tuple instead of 3-tupleAny suggestion on how to proceed is appreciated!!
Beta Was this translation helpful? Give feedback.
All reactions