Closed luckydog1996 closed 4 years ago
Ah, this is an understandable thing to be confused about --
Assuming you're referring to this bit:
f = lambda W: net.loss(X, y, reg=0.05)[0]
param_grad_num = eval_numerical_gradient(f, net.params[param_name], verbose=False)
The W
passed into the lambda function is ignored, but eval_numerical_gradient
directly mutates its second parameter (net.params[param_name]
), which is then used when the loss is computed.
Thanks do much for your help!
This is from Assignment_1, two_layer_net jupyter notebook. And I not sure how function net.loss actually act on W? It seems there is no relationship?