def trace(self, A):
    tr = paddle.diagonal(A, axis1=(- 2), axis2=(- 1))
    tr = paddle.sum(tr, axis=(- 1))
    return tr
def trace(self, A):
    tr = paddle.diagonal(A, axis1=(- 2), axis2=(- 1))
    tr = paddle.sum(tr, axis=(- 1))
    return tr