torch.autograd.gradcheck
torch.autograd.gradcheck(func, inputs, *, eps=1e-06, atol=1e-05, rtol=0.001, raise_exception=True, check_sparse_nnz=False, nondet_tol=0.0, check_undefined_grad=True, check_grad_dtypes=False, check_batched_grad=False, check_batched_forward_grad=False, check_forward_ad=False, check_backward_ad=True, fast_mode=False)
Check gradients computed via small finite differences against
   analytical gradients w.r.t. tensors in "inputs" that are of
   floating point or complex type and with "requires_grad=True".
The check between numerical and analytical gradients uses
   "allclose()".
For most of the complex functions we consider for optimization
   purposes, no notion of Jacobian exists. Instead, gradcheck verifies
   if the numerical and analytical values of the Wirtinger and
   Conjugate Wirtinger derivatives are consistent. Because the
   gradient computation is done under the assumption that the overall