code: def mark_variables(variables, gradients, grad_reqs="write"):
      """Mark NDArrays as variables to compute gradient for autograd.
  
      This is equivalent to the function .attach_grad() in a variable, but with this
      call we can set the gradient to any value.
  
      Parameters
      ----------
      variables: NDArray or list of NDArray
      gradients: NDArray or list of NDArray
      grad_reqs: str or list of str
      """
      if isinstance(variables, NDArray):
          assert isinstance(gradients, NDArray)
          variables = [variables]
          gradients = [gradients]
  
      if isinstance(grad_reqs, string_types):
          grad_reqs = [_GRAD_REQ_MAP[grad_reqs]] * len(variables)
      else:
          grad_reqs = [_GRAD_REQ_MAP[i] for i in grad_reqs]
  
      check_call(
          _LIB.MXAutogradMarkVariables(
              len(variables),
              c_handle_array(variables),
              c_array_buf(mx_uint, array("I", grad_reqs)),
              c_handle_array(gradients),
          )
      )
  
imports: from array import array
  from threading import Lock
  import traceback
  import ctypes
  from ctypes import c_int, c_void_p, CFUNCTYPE, POINTER, cast
  from .base import _LIB, check_call, string_types, mx_uint
  from .base import NDArrayHandle, c_array, c_handle_array, c_array_buf, MXCallbackList, SymbolHandle
  from .ndarray import NDArray, _ndarray_cls
  from .ndarray import _GRAD_REQ_MAP
  from .symbol import Symbol
  from .util import is_np_array
label_desc: Use image node_id 9 for calling a global function with example usage: mark_variables(variables, gradients, grad_reqs) without return types