'Gives the (sub/super)gradient of the atom w.r.t. each argument.
Matrix expressions are vectorized, so the gradient is a matrix.
Args:
values: A list of numeric values for the arguments.
Returns:
A list of SciPy CSC sparse matrices or None.'

def _grad(self, values):

    rows = (self.args[0].size[0] * self.args[0].size[1])
    cols = (self.size[0] * self.size[1])
    if (self.p == 0):
        return [sp.csc_matrix((rows, cols), dtype='float64')]
    if ((not is_power2(self.p)) and (np.min(values[0]) <= 0)):
        if (self.p < 1):
            return [None]
        else:
            values[0] = np.maximum(values[0], 0)
    grad_vals = (float(self.p) * np.power(values[0], (float(self.p) - 1)))
    return [power.elemwise_grad_to_diag(grad_vals, rows, cols)]
