code: def test_basic(instances, sgd):
      X, y = instances
      nr_class = 3
      model = SparseLinear(nr_class).initialize()
      yh, backprop = model.begin_update(X)
      loss1 = ((yh - y) ** 2).sum()
      backprop(yh - y)
      model.finish_update(sgd)
      yh, backprop = model.begin_update(X)
      loss2 = ((yh - y) ** 2).sum()
      assert loss2 < loss1
  
file_path: thinc/thinc/tests/layers/test_sparse_linear.py
imports: import math
  import numpy
  import pytest
  from thinc.api import SGD, SparseLinear, SparseLinear_v2, to_categorical
label_desc: Use image node_id 3 for calling a global function with example usage: test_basic(instances, sgd) without return types