The error is because you’re trying to create a FloatTensor from a Variable:
torch.FloatTensor(W)  # W is of type 'Variable'

Here’s a way to do a average (assuming you don’t care about back-propagating through the average):
W = Variable(w_init, requires_grad=True)
W_avg = torch.zeros(W.size()).type(dtype)  # Tensor, not Variable since you don't care about gradients
for i in range(nb_iterations):
    #some GD stuff...
    W_avg += (1/nb_iter)*W.data

Note the W.data. This extracts the Tensor from the Variable wrapper, since you don’t care about back-propagating through the average.