Added numComponents argument to Function::grad(), with default matching the legacy behavior.