I have 3 networks with same architecture - A, B & C
The weights of C are set as convex combination of weights of A & B as shown below
for a_param, b_param, c_param in zip(a.parameters(), b.parameters(),
                                               c.parameters()):
    c_param.data = weight * a_param.data + (1 - weight) * b_param.data

On doing forward pass through C and using backward as shown below, gradients for A & B aren’t being calculated.
y = c.forward(x)
optimiser.zero_grad()
y.backward()
optimiser.step()

Can anyone tell which step is blocking the gradient flow?
EDIT - After changing the code according to @SimonW 's answer
for a_param, b_param, c_param in zip(a.parameters(), b.parameters(),
                                               c.parameters()):
    c_param.data = weight * a_param + (1 - weight) * b_param


Not that if data of c isn’t updated, then it doesn’t reflect the changes in actual pass, hence it is retained
This still doesn’t work. What’s causing the block now?