inputs = (inputs,) if isinstance(inputs, torch.Tensor) else tuple(inputs)
    overridable_args = outputs + inputs
    if has_torch_function(overridable_args):
        return handle_torch_function(
            grad,
            overridable_args,
            outputs,
            inputs,
            grad_outputs=grad_outputs,
            retain_graph=retain_graph,
            create_graph=create_graph,
            only_inputs=only_inputs,
            allow_unused=allow_unused,
        )
grad_outputs_ = _tensor_or_tensors_to_tuple(grad_outputs, len(outputs))
grad_outputs_ = _make_grads(outputs, grad_outputs_)

if retain_graph is None:
    retain_graph = create_graph

if is_grads_batched:
    # …. It will not be covered here
else:
    return Variable._execution_engine.run_backward(
        outputs, grad_outputs_, retain_graph, create_graph, inputs,
        allow_unused, accumulate_grad=False)  # Calls into the C++ engine to run the backward pass

```