github.com/pytorch/pytorch
  
  
    



Issue: Unexpected behavior when initializing float tensor from numpy boolean array 33


	
	opened by alexub
	on 2017-12-21
	
	
	


torch.Tensor(np.asarray([True, False])) appears to have the same behavior as torch.Tensor(size=2).
Both give something like -3.8315e+06 4.5761e-41 [torch.FloatTensor of size 2]
Same behavior with...




  
  
    
    
  
  


My bad. This is a known issue. In case someone else has a similar problem, the workaround is to cast the numpy array as a supported dtype, eg uint8, prior to turning it into a ByteTensor.