Skip to content

Conversation

@mruberry
Copy link
Collaborator

@mruberry mruberry commented Jul 23, 2020

This PR creates a new namespace, torch.fft (torch::fft) and puts a single function, fft, in it. This function is analogous to is a simplified version of NumPy's numpy.fft.fft that accepts no optional arguments. It is intended to demonstrate how to add and document functions in the namespace, and is not intended to deprecate the existing torch.fft function.

Adding this namespace was complicated by the existence of the torch.fft function in Python. Creating a torch.fft Python module makes this name ambiguous: does it refer to a function or module? If the JIT didn't exist, a solution to this problem would have been to make torch.fft refer to a callable class that mimicked both the function and module. The JIT, however, cannot understand this pattern. As a workaround it's required to explicitly import torch.fft to access the torch.fft.fft function in Python:

import torch.fft

t = torch.randn(128, dtype=torch.cdouble)
torch.fft.fft(t)

See #42175 for future work. Another possible future PR is to get the JIT to understand torch.fft as a callable class so it need not be imported explicitly to be used.

@mruberry mruberry requested review from albanD and apaszke as code owners July 23, 2020 07:45
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jul 23, 2020
@dr-ci
Copy link

dr-ci bot commented Jul 23, 2020

💊 CI failures summary and remediations

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


  • 2/2 failures possibly* introduced in this PR
    • 1/2 non-CircleCI failure(s)

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_ge_config_profiling_test (1/1)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

Aug 05 08:46:51 caused by: Connection refused (os error 111)
Aug 05 08:46:51 ++++ extract_trap_cmd 
Aug 05 08:46:51 ++++ printf '%s\n' '' 
Aug 05 08:46:51 +++ printf '%s\n' cleanup 
Aug 05 08:46:51 ++ trap -- ' 
Aug 05 08:46:51 cleanup' EXIT 
Aug 05 08:46:51 ++ [[ pytorch-linux-xenial-py3.6-gcc5.4-ge_config_profiling-test != *pytorch-win-* ]] 
Aug 05 08:46:51 ++ which sccache 
Aug 05 08:46:51 ++ sccache --stop-server 
Aug 05 08:46:51 Stopping sccache server... 
Aug 05 08:46:51 error: couldn't connect to server 
Aug 05 08:46:51 caused by: Connection refused (os error 111) 
Aug 05 08:46:51 ++ true 
Aug 05 08:46:51 ++ rm /var/lib/jenkins/sccache_error.log 
Aug 05 08:46:51 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log 
Aug 05 08:46:51 ++ SCCACHE_IDLE_TIMEOUT=1200 
Aug 05 08:46:51 ++ RUST_LOG=sccache::server=error 
Aug 05 08:46:51 ++ sccache --start-server 
Aug 05 08:46:51 Starting sccache server... 
Aug 05 08:46:51 ++ sccache --zero-stats 
Aug 05 08:46:51 Compile requests                 0 
Aug 05 08:46:51 Compile requests executed        0 

ci.pytorch.org: 1 failed


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 or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 99 times.

@mruberry mruberry removed request for albanD and apaszke July 23, 2020 22:14
@mruberry mruberry removed the request for review from yf225 August 3, 2020 13:32
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.

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

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.

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

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.

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

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in ccfce9d.

facebook-github-bot pushed a commit that referenced this pull request Aug 7, 2020
Summary:
This PR adds the `torch.linalg` namespace as part of our continued effort to be more compatible with NumPy. The namespace is tested by adding a single function, `torch.linalg.outer`, and testing it in a new test suite, test_linalg.py. It follows the same pattern that #41911, which added the `torch.fft` namespace, did.

Future PRs will likely:

- add more functions to torch.linalg
- expand the testing done in test_linalg.py, including legacy functions, like torch.ger
- deprecate existing linalg functions outside of `torch.linalg` in preference to the new namespace

Pull Request resolved: #42664

Reviewed By: ngimel

Differential Revision: D22991019

Pulled By: mruberry

fbshipit-source-id: 39258d9b116a916817b3588f160b141f956e5d0b
@mruberry mruberry deleted the torch_fft branch August 21, 2020 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants