code: def test_graceful_squeezing(loss):
      """Test that reshaped raw_prediction gives same results."""
      y_true, raw_prediction = random_y_true_raw_prediction(
          loss=loss,
          n_samples=20,
          y_bound=(-100, 100),
          raw_bound=(-10, 10),
          seed=42,
      )
  
      if raw_prediction.ndim == 1:
          raw_prediction_2d = raw_prediction[:, None]
          assert_allclose(
              loss.loss(
                  y_true=y_true, raw_prediction=raw_prediction_2d
              ),
              loss.loss(y_true=y_true, raw_prediction=raw_prediction),
          )
          assert_allclose(
              loss.loss_gradient(
                  y_true=y_true, raw_prediction=raw_prediction_2d
              ),
              loss.loss_gradient(
                  y_true=y_true, raw_prediction=raw_prediction
              ),
          )
          assert_allclose(
              loss.gradient(
                  y_true=y_true, raw_prediction=raw_prediction_2d
              ),
              loss.gradient(
                  y_true=y_true, raw_prediction=raw_prediction
              ),
          )
          assert_allclose(
              loss.gradient_hessian(
                  y_true=y_true, raw_prediction=raw_prediction_2d
              ),
              loss.gradient_hessian(
                  y_true=y_true, raw_prediction=raw_prediction
              ),
          )
  
imports: import pickle
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from pytest import approx
  from scipy.optimize import LinearConstraint, minimize, minimize_scalar, newton
  from scipy.special import logsumexp
  from sklearn._loss.link import IdentityLink, _inclusive_low_high
  from sklearn._loss.loss import _LOSSES, AbsoluteError, BaseLoss, HalfBinomialLoss, HalfGammaLoss, HalfMultinomialLoss, HalfPoissonLoss, HalfSquaredError, HalfTweedieLoss, HalfTweedieLossIdentity, HuberLoss, PinballLoss
  from sklearn.utils import _IS_WASM, assert_all_finite
  from sklearn.utils._testing import create_memmap_backed_data, skip_if_32bit
label_desc: Use image node_id 12 for calling a global function with example usage: test_graceful_squeezing(loss) without return types