pytorch / xla

Enabling PyTorch on XLA Devices (e.g. Google TPU)
https://pytorch.org/xla
Other
2.49k stars 483 forks source link

norm and pca_lowrank op info test from issue #7528 #8384

Open vyom1611 opened 1 week ago

vyom1611 commented 1 week ago

Added norm and pca_lowrank implementations for op test, however currently the lowarnk_pca test fails because of :

FAILED test/test_ops.py::TestOpInfoCPU::test_reference_eager_pca_lowrank_cpu_float32 - AssertionError: Tensor-likes are not close!

Upon checking with debug print statements, I saw that the only case it doesn't match is because of sign ambiguity here:

Expected: tensor([[-0.2460],
        [-0.7316],
        [ 0.4821],
        [ 0.4043],
        [ 0.0912]])
Got: tensor([[ 0.2460],
        [ 0.7316],
        [-0.4821],
        [-0.4043],
        [-0.0912]])
Absolute difference: tensor([[0.4920],
        [1.4632],
        [0.9642],
        [0.8087],
        [0.1823]])
Relative difference: tensor([[2.0000],
        [2.0000],
        [2.0000],
        [2.0000],
        [2.0000]])

That is the only fix remaining, and then it should be good to go.