There are I guess other reasons that a None is returned for such gradient, for example, because of a mistake in the code. But, apparently if the function’s gradient is independent of the
target variable, a None is also returned (which should actually be a zero mathematically).
So the main problem is that one will not be sure if the None is because of a bug in the code or because of the independence of the function with respect to the variable.