'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.'

def attach_grad(self, grad_req='write'):

    grad = zeros_like(self)
    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)))
