[Update transforms.py]: use build-in atanh in TanhTransform#40160
[Update transforms.py]: use build-in atanh in TanhTransform#40160zuoxingdong wants to merge 1 commit intopytorch:masterfrom
atanh in TanhTransform#40160Conversation
💊 CI failures summary and remediationsAs of commit 081e131 (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 1 time. |
|
Had a look into the console log file, it seems that the error comes from |
|
@fritzo, @neerajprad -- github is suggesting you two as reviewers, could you take a look please? |
|
|
||
| @staticmethod | ||
| def atanh(x): | ||
| return 0.5 * (x.log1p() - (-x).log1p()) |
There was a problem hiding this comment.
I am concerned that the code looks like this for numeric stability reasons, but there is no comment to that effect here
There was a problem hiding this comment.
That's right. Specially for values close to 0, this will be more accurate than the 0.5*log((1+x)/(1-x)) formulation.
|
LGTM. The failure is unrelated. @pytorchbot merge this please. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…40160) Summary: Since `torch.atanh` is recently implemented in pytorch#38388, we should simply use it for `TanhTransform`. Pull Request resolved: pytorch#40160 Differential Revision: D22208039 Pulled By: ezyang fbshipit-source-id: 34dfbc91eb9383461e16d3452e3ebe295f39df26
Since
torch.atanhis recently implemented in #38388, we should simply use it forTanhTransform.