While going over the pseudocode of the CURL paper, the method to identify labels from the logits wasn't clear to me. I believe this technique might be common in other PyTorch/Deep Learning tasks. I have attached the pseudocode below -
1 Answer
Given arange
returns a 1-D tensor with values from 0
to logits.shape[0]
, then the labels is a vector of $0$ to $N$ where $N$ is the number of classes predicted by the output layer of f_q
.
The CrossEntropyLoss then finds the difference between the predictions and the target labels, which the encoder weights f_q.params
is updated according to. I haven't read the paper, but this particular part is a standard multi-class classification approach.