code: def test_op_times_sparse_grad(device_id, precision):
      dt_precision = PRECISION_TO_TYPE[precision]
  
      from cntk import (
          times,
          times_transpose,
          parameter,
          reshape,
          Value,
          sequence,
      )
  
      dim = 5
      num_sequences = 2
      seq = [i for i in range(dim)]
      identity = np.identity(dim, dtype=dt_precision)
      input_data = Value.one_hot(
          [seq] * num_sequences, dim, dtype=dt_precision
      )
      input_var = sequence.input_variable(
          shape=(dim),
          is_sparse=True,
          needs_gradient=False,
          dtype=dt_precision,
      )
      e = parameter(shape=(dim, dim), init=identity, dtype=dt_precision)
      z = reshape(times_transpose(e, times(input_var, e)), dim)
      e_grad = z.grad({input_var: input_data}, [e])
  
      assert np.allclose(e_grad, np.ones((dim, dim)) * 4)
  
imports: from __future__ import division
  import numpy
  import pytest
  import cntk
  from .ops_test_utils import unittest_helper, _test_unary_op, _test_binary_op, AA, precision, PRECISION_TO_TYPE, cntk_device
  from cntk.internal import sanitize_dtype_cntk
  from cntk.internal.utils import _ones_like, eval
label_desc: Use image node_id 15 for calling a global function with example usage: test_op_times_sparse_grad(device_id, precision) without return types