def test_conv_layer_grads():
    """
    Checking that the gradients are correctly backpropagated through the convolutional layer
    """
    synth_model = get_synthetic_model()
    output_channels = 12
    input_channels = 3
    loss_fn = torch.nn.MSELoss()

    device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
    target = torch.rand(size=(32, 12, 21, 21)).to(device)

    synthetic_data = torch.rand(32, input_channels, 25, 25).to(device)
    model = synth_model(
        input_shape=synthetic_data.shape, output_channels=output_channels, kernel_size=5, bias=True, stride=1
    )
    model = model.to(device)
    output_from_equivalent = model.forward(synthetic_data)
    loss = loss_fn(output_from_equivalent, target)
    loss.backward()

    equivalent_grads = model.conv1.conv.weight.grad
    equivalent_grads = (
        torch.reshape(equivalent_grads, shape=(output_channels, input_channels, 5, 5)).detach().clone().to(device)
    )
    equivalent_bias = model.conv1.bias_to_grad.grad.data.detach().clone().to(device)

    model.zero_grad()
    output_from_conv = model.conv1.conv_debug(synthetic_data)
    loss = loss_fn(output_from_conv, target)
    loss.backward()

    assert torch.allclose(equivalent_grads, model.conv1.conv_debug.weight.grad, atol=1e-05)
    assert torch.allclose(equivalent_bias, model.conv1.conv_debug.bias.grad, atol=1e-05)

    Checking that the gradients are correctly backpropagated through the convolutional layer
    
tests/estimators/certification/test_interval.py