Pytorch disable gradient calculation
Checks if gradient calculation is disabled during evaluation.
def disable_gradient_calculation_noncompliant():
    import torch
    # Noncompliant: disables gradient calculation using `torch.no_grad()`.
    with torch.no_grad():
        model.eval()
def disable_gradient_calculation_compliant():
    import torch
    # Compliant: disables gradient calculation using `torch.inference_mode()`.
    with torch.inference_mode():
        model.eval()