This was happening when I read data from a numpy array to a Variable X:
X = Variable(torch.from_numpy(X))
mu = Variable(torch.randn(D, K), requires_grad=True)
But when I changed it to X = torch.FloatTensor(X), subtraction was fine. What is the reason for this?