Answers.Body: <p>Given <code>arange</code> returns a 1-D tensor with values from <code>0</code> to <code>logits.shape[0]</code>, then the labels is a vector of <span class="math-container">$0$</span> to <span class="math-container">$N$</span> where <span class="math-container">$N$</span> is the number of classes predicted by the output layer of <code>f_q</code>.</p>
  <p>The CrossEntropyLoss then finds the difference between the predictions and the target labels, which the encoder weights <code>f_q.params</code> is updated according to. I haven't read the paper, but this particular part is a standard <a href="https://en.wikipedia.org/wiki/Multiclass_classification" rel="nofollow noreferrer">multi-class classification</a> approach.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-20T05:26:57.910Z
Answers.LastActivityDate: 2021-06-20T05:26:57.910Z
Answers.UserDisplayName: mugoh
Body: <p>While going over the pseudocode of the <a href="https://arxiv.org/pdf/2004.04136.pdf" rel="nofollow noreferrer">CURL paper</a>, 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 -</p>
  <p><a href="https://i.sstatic.net/LncXH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LncXH.png" alt="enter image description here" /></a></p>
  
Tags: <reinforcement-learning><deep-learning><papers><pytorch><unsupervised-learning>
Title: How does CURL extract labels from logits?
UserDisplayName: desert_ranger
ThreadText: # How does CURL extract labels from logits?
  
  (Asked by: username_0 on 2021-06-19)
  
  While going over the pseudocode of the [CURL paper](https://arxiv.org/pdf/2004.04136.pdf), 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 -
  
  [![enter image description here](https://i.sstatic.net/LncXH.png)](https://i.sstatic.net/LncXH.png)
  
  **Tags:** reinforcement-learning, deep-learning, papers, pytorch, unsupervised-learning
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-20. Score: 1 | Accepted 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](https://en.wikipedia.org/wiki/Multiclass_classification) approach.
  
  
  ---
  
  