InnovArul:

I mean, you can write C network fully interms of functional APIs.


Exactly. Wouldn’t I have to write another class for it that uses the functional API.
Check 7 my code right now, using requires_grad.
I am able to reuse the same class LinearNetwork for both basis networks (A & B) and also for main network ( C ).
Suppose instead of LinearNetwork, I wanted to generate weights for this PFNN itself using another network, then I would need to rewrite the whole class using functional API, wouldn’t I?



 InnovArul:

But you could get away from spending effort to juggle with requires_grad stuffs.


I feel requires_grad prevents this redundancy.



 SimonW:

In your case, c_param is not really a parameter, but an intermediate result.


Yeah but to do a forward pass easily, I could set it as parameters of the net and call it’s forward method. Either this or I have to re-write the network using functional API.