[resolved in master] Torch.diag on a Variable - weird behavior

Does torch.diag work on variables without calling .data ? I’m getting weird behavior:

x = Variable(torch.ones((5,5)))
print(torch.diag(x)) # prints diag
print(torch.diag(x,1)) # still prints middle diag
print(torch.diag(x,2)) # still prints middle diag
print(torch.diag(x.data, 2)) # prints correct diag

EDIT: this was a small bug which should be fixed now.