Calculate gradient for input while validation

Hi,
I am trying to accumulate gradients with respect to the input (d(Loss)/dW1) where W1 is the input layer weight matrix while running the validation dataset. I am not able to run the “on_backward_end” function on validation set since the params dont get updated. Is there an easy way to do this?

Thanks!