'Returns a gradient buffer for this parameter on one context.
Parameters
ctx : Context
Desired context.'

def grad(self, ctx=None):

    if (ctx is None):
        list_ctx = self.list_ctx()
        if (len(list_ctx) == 1):
            ctx = list_ctx[0]
        else:
            ctx = context.current_context()
    self._check_initialized(ctx)
    if (self._grad is None):
        raise RuntimeError(("Cannot    get    gradient    array    for    Parameter    %s    because    grad_req='null'" % self.name))
    return self._grad[ctx]
