code: def test_assign_gradient(input_data, device_id, precision):
      dt = PRECISION_TO_TYPE[precision]
      data = AA(input_data, dtype=dt)
  
      value = C.parameter(init=data)
      dest = C.parameter(shape=data.shape, dtype=dt)
      assign_op = C.assign(dest, value)
  
      bwd, fwd = assign_op.forward(
          {}, [assign_op.output], set([assign_op.output])
      )
      # dest will be updated after backprop, so verify that it isn't updated yet.
      assert not np.array_equal(dest.asarray(), data)
  
      result = list(fwd.values())[0]
      grad = assign_op.backward(
          bwd, {assign_op.output: np.ones_like(result)}, set([dest])
      )
  
      # dest should have the new value by now.
      assert np.array_equal(dest.asarray(), data)
  
      # check the gradient.
      assert np.array_equal(grad[dest], np.zeros_like(result))
  
file_path: CNTK/bindings/python/cntk/ops/tests/assign_test.py
imports: import numpy
  import pytest
  import cntk
  from .ops_test_utils import unittest_helper, _test_unary_op, AA, precision, PRECISION_TO_TYPE, constant
  from cntk.internal import sanitize_dtype_cntk
label_desc: Use image node_id 4 for calling a global function with example usage: test_assign_gradient(input_data, device_id, precision) without return types