code: def test_consistency_losses_with_oteytaud(loss_name: str) -> None:
      path = Path(__file__).with_name("headrgb_olivier.png")
      image = PIL.Image.open(path).resize((256, 256), PIL.Image.BICUBIC)
      data = np.asarray(image)[
          :, :, :3
      ]  # 4th Channel is pointless here, only 255.
  
      data_flip = np.flip(
          data, 0
      ).copy()  # Copy necessary as some nets do not support negative stride.
      loss_class = imagelosses.registry[loss_name]
      loss = loss_class(reference=data)
      random_data = np.random.uniform(
          low=0.0, high=255.0, size=data.shape
      )
      loss_data = loss(data)
      assert loss_data < 1000.0
      assert loss_data > -1000.0
      assert loss_data == loss(data)
      assert isinstance(loss_data, float)
      loss_random_data = loss(random_data)
      assert loss_random_data == loss(random_data)
      assert (
          "Blur" in loss_name or loss_data < loss_random_data
      ), f"Loss {loss_name} fails on oteytaud's photo."
      if loss.REQUIRES_REFERENCE:
          assert loss_data == 0.0
          if "Histogram" not in loss_name:
              assert loss_data < loss(data_flip)
          else:
              assert loss_data == loss(data_flip)
  
file_path: nevergrad/nevergrad/functions/images/test_imagelosses.py
imports: from pathlib import Path
  import PIL.Image
  import numpy
  import pytest
  from nevergrad.functions.images import imagelosses
label_desc: Use image node_id 3 for calling a global function with example usage: test_consistency_losses_with_oteytaud(loss_name) without return types