我想做这样的事情:
# pytorch_model to train, caffe_model freezed
torch_out = pytorch_model(input)
caffe_out = caffe_model(torch_out)
loss = criterion(caffe_out, label)
loss.backward() # or something like torch_out.backward()
我可以轻松地获得caffe_model.backward()提供的torch_out的渐变,但是如何用它更新pytorch_model?