KEMBAR78
tan/tanh discrepancies with complex due to jiterator · Issue #110014 · pytorch/pytorch · GitHub
Skip to content

tan/tanh discrepancies with complex due to jiterator #110014

@janeyx99

Description

@janeyx99

🐛 Describe the bug

There is perhaps a large discrepancy (requiring atol being increased to 3e-4) between the before+after #102427 implementation of tan/tanh on CUDA with complex values.

Repro:

import torch
x = torch.tensor(-7.8167-0.0451j, device='cuda:0')
torch.set_printoptions(precision=10)
print(torch.tan(x))
print(torch._foreach_tan([x])[0])
print(torch._foreach_tan([x.to(device="cpu")])[0])

Before:
image

After:
image

I happened to observe this when debugging why some tan tests were failing when I added new sample inputs to the foreach tests in #109402 (comment).

Versions

trunk

cc @ptrblck @mruberry @parth-desai @peterbell10

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: cudaRelated to torch.cuda, and CUDA support in generalmodule: jiteratortriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions