NN.Parameter code

Hi Team,

I debugged the attached code and observed that X_train is getting passed to forward function but I’,m not getting idea how it’s getting passed.

I tried changing the name of X_train like X_train_1 and tried executing the code then also saw that forward function start taking X_train_1 values. Isn’t it bound to variable name means X__train only needs to be passed if nn.Module directly calls the forward function?

Please give me a detailed explaination on this.



Hi, Please note that this is class definition. The instance where you pass X_train is independent of definition, as it uses a local variable X on each call.