Hello,
I’m using a pretrained model with its parameters frozen. The output of the model is a dictionary containing the output of the intermediate network layers. Now I do the following:
a = b.clone()
a = nn.Parameter(a, required_grad=True)
res = model(a)

where b is a input tensor to the model
and then I did
for _, v in res.items():
     v.backward()

it causes a RuntimeError:
File ".../lib/python3.8/site-packages/torch/tensor.py", line 198, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File ".../lib/python3.8/site-packages/torch/autograd/__init__.py", line 98, in backward
Variable._execution_engine.run_backward(
RuntimeError: not enough values to unpack (expected 2, got 0)

I’m not sure if I’m using .backward() wrong or it’s the model that causes this error…
would appreciate any help