'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):

    max_vals = np.matrix(self.numeric(values))
    unused = np.matrix(np.ones(max_vals.shape), dtype=bool)
    grad_list = []
    for (idx, value) in enumerate(values):
        rows = (self.args[idx].size[0] * self.args[idx].size[1])
        cols = (self.size[0] * self.size[1])
        grad_vals = ((value == max_vals) & unused)
        unused[(value == max_vals)] = 0
        grad_list += [max_elemwise.elemwise_grad_to_diag(grad_vals, rows, cols)]
    return grad_list
