Your Function class is not correct, I think it should be:
class ICA_3D_MM(Function):

    @staticmethod
    def forward(ctx, mu, sigma, landa, eps, dimX, dimY, dimZ):
         #some ops  
         return A, KL

    @staticmethod
    def backward(ctx, grad_1, grad_2):
        #some ops
        return grad_mu, grad_sigma, grad_landa, grad_eps, grad_dimX, grad_dimY, grad_dim_Z