what I want to do is like this:
# on cuda:0
output = model.forward(input)

# on cuda:1
# calculate perceptron loss
output.cuda(1)
loss = perceptron_loss(output, target)

loss.backward()

loss.backward() will work?