Hello!
While coding in pytorch feels way “closer to the essence” than in static graph frameworks, i can’t help but notice that i spend a third of my coding time converting stuff between variables, cpu tensors, gpu tensors, numpy arrays, sparse tensors, etc.
To inject data into pytorch, one first has to torch.FloatTensor(data), then Variable(…) and then .cuda(). To cast loss back into python float one must .data.cpu().numpy().[0]. It isn’t that bad, but it is a bit too verbose in my humble opinion.
Is there a common set of “best practices” to minimize such kinds of code?
p.s. personally i found myself using a mini-library like this one 10 to make code less verbose. If it is of any help to anyone else, help yourself