Ah ha! There is a difference between the two versions of foo:
One is of size (6,1) and the other is of size (6,)
If I squeeze the inds_above10 tensor, then my case works.
Related to the error that someone was seeing here:

  
      github.com/pytorch/pytorch
  
  
    



Issue: Bug with Advanced Indexing on GPU variables 6


	
	opened by adambielski
	on 2017-10-01
	
	
	closed by soumith
	on 2017-10-04
	


Simple example: Let's try advanced indexing with object convertible to LongTensor on CPU
import torch
from torch.autograd import Variable
import numpy as np
print(torch.__version__) #0.2.0_3
x...




  
  
    
    
  
  


It would be super nice if the error message could say “You gave us what is essentially a row vector / column vector but we want it to be a rank-1 tensor.”
Also: If I give a rank-1 tensor to torch.nonzero, the output should probably be a rank-1 tensor, right?