RuntimeError: Found dtype Double but expected Float”

RuntimeError: Found dtype Double but expected Float”

I made a mistake in finding the loss function,

resolvent:

target.float()

a=np.array([[1,2],[3,4]])
b=np.array([[2,3],[4,4]])

loss_fn = torch.nn.MSELoss(reduce=True, size_average=True)

input = torch.autograd.Variable(torch.from_numpy(a))
target = torch.autograd.Variable(torch.from_numpy(b))

loss = loss_fn(input.float(), target.float())

print(loss)

Read More: