code: def test_loss_from_config(name, kwargs, args):
      """Test that losses are loaded and configured correctly from registry
      (as partials)."""
      cfg = {"test": {"@losses": name, **kwargs}}
      func = registry.resolve(cfg)["test"]
      loss = func.get_grad(*args)
      if isinstance(loss, (list, tuple)):
          loss = loss[0]
      assert loss.ndim == 2
      func.get_loss(*args)
      func(*args)
  
file_path: thinc/thinc/tests/test_loss.py
imports: import numpy
  import pytest
  from thinc import registry
  from thinc.api import CategoricalCrossentropy, CosineDistance, L2Distance, SequenceCategoricalCrossentropy
label_desc: Use image node_id 13 for calling a global function with example usage: test_loss_from_config(name, kwargs, args) without return types