Solved by ptrblck in post #2 
              
              
                In your current example you’ll already create a torch.FloatTensor, since the type will be inferred automatically using the passed values. 
However, if you would like to specify it, you could pass the dtype argument: 
x = torch.tensor([[1., -1.], [1., 1.]], dtype=torch.float, requires_grad=True)
prin…