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

    X = values[0]
    Y = values[1]
    DX_rows = (self.args[0].size[0] * self.args[0].size[1])
    cols = (self.args[0].size[0] * self.args[1].size[1])
    DX = sp.dok_matrix((DX_rows, cols))
    for k in range(self.args[0].size[0]):
        DX[k::self.args[0].size[0], k::self.args[0].size[0]] = Y
    DX = sp.csc_matrix(DX)
    DY = sp.block_diag([X.T for k in range(self.args[1].size[1])], 'csc')
    return [DX, DY]
