generally speaking, the pattern is:


use .cuda() on any input batches/tensors


use .cuda() on your network module, which will hold your network, like:
class MyModel(nn.Module):
def init(self):
self.layer1 = nn. …
self.layer2 = nn. …
… etc …


then just do:
model = MyModel()
model.cuda()