practical-cnn
practical-cnn copied to clipboard
quastion about derivative - part 2
hi, in part 2 there is a calculation of dzdx_empirical , can somone help and explain the calculation? why is there a sum? and why is there a division by eta and not a division by etx*ex (as i expected to be)?
thanks!
% Check the derivative numerically ex = randn(size(x), 'single') ; eta = 0.0001 ; xp = x + eta * ex ; yp = vl_nnconv(xp, w, []) ;
dzdx_empirical = sum(dzdy(:) .* (yp(:) - y(:)) / eta) ; dzdx_computed = sum(dzdx(:) .* ex(:)) ;
fprintf(... 'der: empirical: %f, computed: %f, error: %.2f %%\n', ... dzdx_empirical, dzdx_computed, ... abs(1 - dzdx_empirical/dzdx_computed)*100) ;