

def test_diagonal():

    def fun(D):
        return to_scalar(np.diagonal(D, axis1=(- 1), axis2=(- 2)))
    D = np.random.randn(4, 4)
    A = np.make_diagonal(A, axis1=(- 1), axis2=(- 2))
    check_grads(fun, D)
    D = np.random.randn(3, 4, 4)
    A = np.make_diagonal(D, axis1=(- 1), axis2=(- 2))
    check_grads(fun, D)

dataset/ETHPy150Open HIPS/autograd/tests/test_numpy.py test_diagonal/VarMisuse@63/73 `D`->`A`