Skip to content

Move normal() to DistributionTemplates#35167

Closed
pbelevich wants to merge 22 commits intogh/pbelevich/90/basefrom
gh/pbelevich/90/head
Closed

Move normal() to DistributionTemplates#35167
pbelevich wants to merge 22 commits intogh/pbelevich/90/basefrom
gh/pbelevich/90/head

Conversation

@pbelevich
Copy link
Contributor

@pbelevich pbelevich commented Mar 21, 2020

The purpose of this PR is to move normal/normal_/normal_out to native/DistributionTemplates.h, native/cpu/DistributionTemplates.h and native/cuda/DistributionTemplates.h to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.

Stack from ghstack:

Differential Revision: D20588248

@dr-ci
Copy link

dr-ci bot commented Mar 21, 2020

💊 CircleCI build failures summary and remediations

As of commit 74050a3 (more details on the Dr. CI page):


  • 2/2 failures introduced in this PR

1 job timed out:

  • pytorch_linux_xenial_py3_clang5_asan_test

Job pytorch_xla_linux_xenial_py3_6_clang7_test is failing. Please create an issue with title prefixed by [PT_BREAK] in pytorch/xla and link to to this PR. If you have questions, please reach out to @ailzhang/@dlibenzi/@JackCaoG.


This 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.

See how this bot performed.

This comment has been revised 89 times.

The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.




[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 22, 2020
ghstack-source-id: b030e01
Pull Request resolved: #35167
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.




[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 22, 2020
ghstack-source-id: 740730f
Pull Request resolved: #35167
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.




[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 22, 2020
ghstack-source-id: 06a8c6c
Pull Request resolved: #35167
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 22, 2020
ghstack-source-id: f18ae30
Pull Request resolved: #35167
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 23, 2020
ghstack-source-id: 6e3b4b8
Pull Request resolved: #35167
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 24, 2020
ghstack-source-id: 838d00b
Pull Request resolved: #35167
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 24, 2020
ghstack-source-id: eede7b3
Pull Request resolved: #35167
@pbelevich
Copy link
Contributor Author

pbelevich commented Mar 25, 2020

@ailzhang what can be the cause of XLA failures?
test_normal_xla_float64
test_randn_xla_float32
test_randn_xla_float64

@pbelevich pbelevich requested review from ailzhang and anjali411 March 25, 2020 01:59
@ailzhang
Copy link
Contributor

cc: @JackCaoG who lowered normal :D. I assume we will not match randn result given we now have XLA-specific normal?
Also we should likely fix test_normal_xla_float64.

The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 25, 2020
ghstack-source-id: cd78c03
Pull Request resolved: #35167
}
} else {
AT_DISPATCH_ALL_TYPES_AND3(kHalf, kBool, kBFloat16, iter.dtype(0), "copy_", [&] {
AT_DISPATCH_ALL_TYPES_AND_COMPLEX_AND3(kHalf, kBool, kBFloat16, iter.dtype(0), "copy_", [&] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fixed in this PR #35344

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

@anjali411 anjali411 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm after fixing the copy_() change :) thanks for the awesome work!

The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
@pbelevich
Copy link
Contributor Author

@ailzhang @JackCaoG should I wait for XLA change or land this PR?

self.assertEqual(r.mean(), 2, 0.2)
self.assertEqual(r.std(), 3, 0.2)
@dtypes(torch.float, torch.double, torch.complex64, torch.complex128)
@dtypesIfCUDA(torch.float, torch.double, torch.complex64, torch.complex128)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious: these two list are identical, is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks!

The purpose of this PR is to move `normal`/`normal_`/`normal_out` to `native/DistributionTemplates.h`, `native/cpu/DistributionTemplates.h` and `native/cuda/DistributionTemplates.h` to make it reusable for custom RNG, see cpu_rng_test.cpp as an example of custom RNG.


Differential Revision: [D20588248](https://our.internmc.facebook.com/intern/diff/D20588248)

[ghstack-poisoned]
pbelevich added a commit that referenced this pull request Mar 25, 2020
ghstack-source-id: 56d5787
Pull Request resolved: #35167
@JackCaoG
Copy link
Collaborator

Sorry, missed the email earlier. I think you can land this pr, xla will skip new tests for now. I will investigate it a bit more, most likely test issue.

Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for waiting! This PR is good to go when you're ready.
[note to self]:
It's fine to remove device dispatch for normal here since we have derivatives defined for

normal(Tensor, double)
normal(double, Tensor)
normal(Tensor, Tensor)

So that they're still overridable by XLA.
normal(double, double) is a composite op defined in TensorFactories.cpp which points to normal_ as leaf node.

@facebook-github-bot
Copy link
Contributor

@pbelevich merged this pull request in 2dd867f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants