title: IndexError: tensors used as indices must be long, byte or bool tensors
body: <p>I am getting this error only during the testing phase, but I do not face any problem in the training and validation phase.</p>
  
  <pre><code>IndexError: tensors used as indices must be long, byte or bool tensors
  </code></pre>
  
  <p>I get this error for the last line in the given code snippet.</p>
  
  <p>The code snippet looks like the one below,</p>
  
  <pre class="lang-py prettyprint-override"><code>NumClass = 10
  mask = torch.zeros(batch_size, self.mem_dim, 4, 4)
  ones = torch.ones(1, 4, 4)
  NumRows = self.mem_dim
  Elements = NumRows//NumClass
  for i in range(batch_size):
      lab = torch.arange(Elements * label[i], Elements*(label[i]+1), 1)
      mask[i,lab] = ones
  </code></pre>
  
  <p>The "lab" is a tensor value and prints out the range in such a way,</p>
  
  <pre><code>tensor([6, 7, 8])
  tensor([ 9, 10, 11])
  tensor([21, 22, 23])
  </code></pre>
  
  <p>(Note*: the length of this lab tensor can be of length 'n' based on the value of ElementsPerClass)</p>