code: def test_sparse_block_row_input(device_id):
      dev = cntk_device(device_id)
      num_classes = 3
  
      w_init = np.asarray([[0, 1], [2, 3], [4, 5]]).astype(np.float32)
      w = C.parameter(init=w_init, device=dev)
  
      x = C.input_variable(())
      sparse_one_hot = C.one_hot(x, num_classes, sparse_output=True)
      t = C.times(sparse_one_hot, w)
      indices = np.asarray([0, 2], dtype=np.float32)
      w_grad_value = t.grad(
          {x: indices}, wrt=[w], device=dev, as_numpy=False
      )
  
      grad_i = C.input_variable(w.shape)
      new_param_value = (0.01 * grad_i + w).eval(
          {grad_i: w_grad_value}, device=dev
      )
      assert np.array_equal(
          new_param_value,
          np.asarray(
              [[[0.01, 1.01], [2.0, 3.0], [4.01, 5.01]]],
              dtype=np.float32,
          ),
      )
  
imports: import numpy
  import scipy
  import pytest
  import cntk
  from .ops_test_utils import cntk_device
  from cntk.axis import Axis
  from ..None import constant
  from cntk.tests.test_utils import _to_dense
label_desc: Use image node_id 12 for calling a global function with example usage: test_sparse_block_row_input(device_id) without return types