Use PyTorch autograd to evaluate a scalar function and return its derivative at every supplied input value.