code: def attach_grad(self, grad_req='write', stype=None):
          
          from . import zeros as _zeros
          if stype is not None:
              grad = _zeros(self.shape, stype=stype)
          else:
              grad = op.zeros_like(self)  # pylint: disable=undefined-variable
          grad_req = _GRAD_REQ_MAP[grad_req]
          check_call(_LIB.MXAutogradMarkVariables(
              1, ctypes.pointer(self.handle),
              ctypes.pointer(mx_uint(grad_req)),
              ctypes.pointer(grad.handle)))
docs: Attach a gradient buffer to this NDArray, so that `backward`
          can compute gradient with respect to it.
  
          Parameters
          ----------
          grad_req : {'write', 'add', 'null'}
              How gradient will be accumulated.
              - 'write': gradient will be overwritten on every backward.
              - 'add': gradient will be added to existing value on every backward.
              - 'null': do not compute gradient for this NDArray.
          stype : str, optional
              The storage type of the gradient array. Defaults to the same stype of this NDArray.