code: def test_L2():
      # L2 loss = 2²+4²=20 (or normalized: 1²+2²=5)
      vec1 = numpy.asarray([[1, 2], [8, 9]])
      vec2 = numpy.asarray([[1, 2], [10, 5]])
      d_vecs = L2Distance().get_grad(vec1, vec2)
      assert d_vecs.shape == vec1.shape
      numpy.testing.assert_allclose(
          d_vecs[0], numpy.zeros(d_vecs[0].shape), rtol=eps, atol=eps
      )
  
      loss_not_normalized = L2Distance(normalize=False).get_loss(
          vec1, vec2
      )
      assert loss_not_normalized == pytest.approx(20, eps)
  
      loss_normalized = L2Distance(normalize=True).get_loss(vec1, vec2)
      assert loss_normalized == pytest.approx(5, eps)
  
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 9 for calling a global function with example usage: test_L2() without return types