title: PyTorch - "Attribute Error: module 'torch' has no attribute 'float'
body: <p>I'm trying to implement the Spatial Transformer Network from <a href="https://pytorch.org/tutorials/intermediate/spatial_transformer_tutorial.html" rel="nofollow noreferrer">here</a> and I am running into this issue:</p>
  
  <pre><code>class STNLayer(torch.nn.Module):
      def __init__(self, input_size):
          super(STNLayer, self).__init__()
          self.input_size = input_size
          self.localization = nn.Sequential(
              nn.Conv2d(self.input_size, 8, kernel_size = 7),
              nn.MaxPool2d(2, stride = 2),
              nn.ReLU(True),
              nn.Conv2d(8, 10, kernel_size = 5),
              nn.MaxPool2d(2, stride = 2),
              nn.ReLU(True)
          )
  
          self.fc_loc = nn.Sequential(
              nn.Linear(10 * 12 * 12, 32),
              nn.ReLU(True),
              #nn.BatchNorm1d(32),
              nn.Linear(32, 3*2)
          )
  
          # Initialize weights to identity transformation
          self.fc_loc[2].weight.data.zero_()
          self.fc_loc[2].bias.data = torch.cuda.FloatTensor([1,0,0,0,1,0])
  </code></pre>
  
  <p>The line </p>
  
  <pre><code>self.fc_loc[2].bias.data = torch.cuda.FloatTensor([1,0,0,0,1,0])
  </code></pre>
  
  <p>is giving the error:</p>
  
  <pre><code>*** AttributeError: module 'torch' has no attribute 'float'
  </code></pre>
  
  <p>How do I fix this?</p>