Thanks for your reply. This seems simpler than what I am doing right now.
Was experimenting a little and resorted to a solution where I would create a zero tensor and set the entries via indexing and that also seemed to work.
a = torch.zeros(1,3)
a[0,0] = x*y
a[0,1] = 1/(x*y)
a[0,2] = x/y