Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rand function for complex dtype #34924

Closed
wants to merge 3 commits into from
Closed

Rand function for complex dtype #34924

wants to merge 3 commits into from

Conversation

kostekIV
Copy link
Contributor

Address #34380

@kostekIV
Copy link
Contributor Author

Hi @anjali411 can you take look at this? I can't edit reviewers, also not sure why ci stopped at only 6 checks. Side note didn't run into issue with view_complex_as_float in header file so I didn't make it inline.

@dr-ci
Copy link

dr-ci bot commented Mar 18, 2020

💊 CircleCI build failures summary and remediations

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


  • 2/4 failures introduced in this PR

  • 2/4 broken upstream at merge base 95ad94c from Mar 21 until Mar 23 (51 commits; 62f11f0 - 0e0386b)

    Please rebase on the viable/strict branch (expand for instructions)

    If your commit is newer than viable/strict, you can try basing on an older, stable commit:

    git fetch https://github.com/pytorch/pytorch viable/strict
    git rebase --onto FETCH_HEAD $(git merge-base origin/master HEAD)
    

    If your commit is older than viable/strict:

    git fetch https://github.com/pytorch/pytorch viable/strict
    git rebase FETCH_HEAD
    

    Check out the recency history of this "viable master" tracking branch.


🕵️ 2 new failures recognized by patterns

The following build failures do not appear to be due to upstream breakages (reran 1 job to discount flakiness):

See CircleCI build pytorch_xla_linux_xenial_py3_6_clang7_build (1/2)

Step: "Build" (full log | pattern match details) <confirmed not flaky by 2 failures>

Mar 23 17:50:18 torch_xla/csrc/aten_xla_type_default.cpp:11460:8: error: no matching member function for call to 'impl_unboxedOnlyKernel'
Mar 23 17:50:18       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Mar 23 17:50:18 /opt/conda/lib/python3.6/site-packages/torch/include/ATen/core/op_registration/op_registration.h:294:74: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'kernel_func' 
Mar 23 17:50:18     std::enable_if_t<guts::is_function_type<FuncType>::value, Options&&> impl_unboxedOnlyKernel(DispatchKey dispatch_key) && { 
Mar 23 17:50:18                                                                          ^ 
Mar 23 17:50:18 torch_xla/csrc/aten_xla_type_default.cpp:11199:8: error: no matching member function for call to 'impl_unboxedOnlyKernel' 
Mar 23 17:50:18       .impl_unboxedOnlyKernel<at::Tensor &(at::Tensor &, double, double, at::Generator *), &AtenXlaType::normal_>(at::DispatchKey::XLATensorId) 
Mar 23 17:50:18       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Mar 23 17:50:18 /opt/conda/lib/python3.6/site-packages/torch/include/ATen/core/op_registration/op_registration.h:294:74: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'kernel_func' 
Mar 23 17:50:18     std::enable_if_t<guts::is_function_type<FuncType>::value, Options&&> impl_unboxedOnlyKernel(DispatchKey dispatch_key) && { 
Mar 23 17:50:18                                                                          ^ 
Mar 23 17:50:18 torch_xla/csrc/aten_xla_type_default.cpp:11460:8: error: no matching member function for call to 'impl_unboxedOnlyKernel' 
Mar 23 17:50:18       .impl_unboxedOnlyKernel<at::Tensor(const at::Tensor &, const at::Tensor &, at::Scalar, at::Scalar, bool, at::Generator *), &AtenXlaType::rrelu_with_noise>(at::DispatchKey::XLATensorId) 
Mar 23 17:50:18       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Mar 23 17:50:18 /opt/conda/lib/python3.6/site-packages/torch/include/ATen/core/op_registration/op_registration.h:294:74: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'kernel_func' 
Mar 23 17:50:18     std::enable_if_t<guts::is_function_type<FuncType>::value, Options&&> impl_unboxedOnlyKernel(DispatchKey dispatch_key) && { 
Mar 23 17:50:18                                                                          ^ 
ackages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.6/site-packages/torch/include/TH -I/opt/conda/lib/python3.6/site-packages/torch/include/THC -I/opt/conda/include/python3.6m -c torch_xla/csrc/batch_norm.cpp -o build/temp.linux-x86_64-3.6/torch_xla/csrc/batch_norm.o -std=c++14 -Wno-sign-compare -Wno-deprecated-declarations -Wno-return-type -Wno-macro-redefined -Wno-return-std-move -DNDEBUG -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_XLAC -D_GLIBCXX_USE_CXX11_ABI=1 
Mar 23 17:50:26 11 errors generated. 
torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.6/site-packages/torch/include/TH -I/opt/conda/lib/python3.6/site-packages/torch/include/THC -I/opt/conda/include/python3.6m -c torch_xla/csrc/layout_manager.cpp -o build/temp.linux-x86_64-3.6/torch_xla/csrc/layout_manager.o -std=c++14 -Wno-sign-compare -Wno-deprecated-declarations -Wno-return-type -Wno-macro-redefined -Wno-return-std-move -DNDEBUG -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_XLAC -D_GLIBCXX_USE_CXX11_ABI=1 
on3.6/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.6/site-packages/torch/include/TH -I/opt/conda/lib/python3.6/site-packages/torch/include/THC -I/opt/conda/include/python3.6m -c torch_xla/csrc/view.cpp -o build/temp.linux-x86_64-3.6/torch_xla/csrc/view.o -std=c++14 -Wno-sign-compare -Wno-deprecated-declarations -Wno-return-type -Wno-macro-redefined -Wno-return-std-move -DNDEBUG -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_XLAC -D_GLIBCXX_USE_CXX11_ABI=1 
te-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.6/site-packages/torch/include/TH -I/opt/conda/lib/python3.6/site-packages/torch/include/THC -I/opt/conda/include/python3.6m -c torch_xla/csrc/nll_loss.cpp -o build/temp.linux-x86_64-3.6/torch_xla/csrc/nll_loss.o -std=c++14 -Wno-sign-compare -Wno-deprecated-declarations -Wno-return-type -Wno-macro-redefined -Wno-return-std-move -DNDEBUG -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_XLAC -D_GLIBCXX_USE_CXX11_ABI=1 

See CircleCI build pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_test (2/2)

Step: "Test" (full log | pattern match details) <confirmed not flaky by 2 failures>

Mar 23 19:59:46 AssertionError: 11 not less than or equal to 1e-05 :
Mar 23 19:59:46 ---------------------------------------------------------------------- 
Mar 23 19:59:46 Traceback (most recent call last): 
Mar 23 19:59:46   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_distributed.py", line 175, in wrapper 
Mar 23 19:59:46     self._join_processes(fn) 
Mar 23 19:59:46   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_distributed.py", line 285, in _join_processes 
Mar 23 19:59:46     self._check_return_codes(elapsed_time) 
Mar 23 19:59:46   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_distributed.py", line 324, in _check_return_codes 
Mar 23 19:59:46     self.assertEqual(p.exitcode, first_process.exitcode) 
Mar 23 19:59:46   File "/opt/conda/lib/python3.6/site-packages/torch/testing/_internal/common_utils.py", line 915, in assertEqual 
Mar 23 19:59:46     super(TestCase, self).assertLessEqual(abs(x - y), prec, message) 
Mar 23 19:59:46 AssertionError: 11 not less than or equal to 1e-05 :  
Mar 23 19:59:46  
Mar 23 19:59:46 ---------------------------------------------------------------------- 
Mar 23 19:59:46 Ran 61 tests in 65.284s 
Mar 23 19:59:46  
Mar 23 19:59:46 FAILED (failures=1, skipped=1) 
Mar 23 19:59:46  
Mar 23 19:59:46 Generating XML reports... 
Mar 23 19:59:46 Traceback (most recent call last): 
Mar 23 19:59:46   File "test/run_test.py", line 682, in <module> 
Mar 23 19:59:46     main() 

🚧 2 upstream failures:

These were probably caused by upstream breakages:


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.

This comment has been revised 11 times.

@anjali411 anjali411 self-requested a review March 20, 2020 01:25
@anjali411
Copy link
Contributor

Hi @kostekIV thanks for working on this! :D I wanted to have randn work for complex tensors on cuda so I added a header here #35056. Once this PR is landed, do you mind updating your PR and also adding rand support for complex on cuda?

@yf225 yf225 added module: complex Related to complex number support in PyTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Mar 20, 2020
@kostekIV
Copy link
Contributor Author

Sure @anjali411 I will do that. Correct me if I am wrong but doesn't rand function in aten/src/ATen/native/TensorFactories.cpp already is for both cpu and cuda, so the change in this pr (after syncing it with #35056) is sufficient for it to work on both cpu and cuda?

@anjali411
Copy link
Contributor

anjali411 commented Mar 20, 2020

Sure @anjali411 I will do that. Correct me if I am wrong but doesn't rand function in aten/src/ATen/native/TensorFactories.cpp already is for both cpu and cuda, so the change in this pr (after syncing it with #35056) is sufficient for it to work on both cpu and cuda?

oh yeah you are right! randn calls into uniform_ which has separate cpu and cuda calls so we don't need to worry about it. This PR looks good overall. I'll let you know once I land #35056 landed. once you update the PR, we can land it. thanks for working on this!! :D

@kostekIV
Copy link
Contributor Author

@anjali411 updated

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

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 :) thanks for the awesome work!

@anjali411 anjali411 changed the title Extract view_complex_as_float to header and apply to rand function. Rand function for complex dtype Mar 23, 2020
if (result.is_complex()) {
auto float_tensor = at::native::view_complex_as_float(result);
float_tensor.uniform_(0, 1, generator);
// we want to return complex tensor not underlaying float tensor.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo- not underlying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, fixed

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@anjali411 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@anjali411
Copy link
Contributor

@kostekIV two tests seem to be failing due to this PR. can you look into it?

@kostekIV
Copy link
Contributor Author

@anjali411 I am honestly at lost here, I was looking for an error and couldn't find what is causing those failures here. I looked into other prs and few of the already merged ones had this 2 failures, for example this had torch_xla/csrc/aten_xla_type_default.cpp:11460:8: error: no matching member function for call to 'impl_unboxedOnlyKernel' and this had AssertionError: 11 not less than or equal to 1e-05. Not sure how to approach this. Thank you for your help :)

@facebook-github-bot
Copy link
Contributor

@anjali411 merged this pull request in ada4077.

@kostekIV kostekIV deleted the complex-rand branch March 26, 2020 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merged module: complex Related to complex number support in PyTorch open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants