Skip to content

[special] add zeta #59623

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

Closed
wants to merge 18 commits into from
Closed

Conversation

kshitij12345
Copy link
Collaborator

@kshitij12345 kshitij12345 commented Jun 8, 2021

Reference #50345

zeta was already present in the codebase to support computation of polygamma.

However, zeta only had double(double, double) signature for CPU before the PR (which meant that computation polygamma were always upcasted to double for zeta part).

With this PR, float computations will take place in float and double in double.

Have also refactored the code and moved the duplicate code from Math.cuh to Math.h

Note: For scipy, q is optional, and if it is None, it defaults 1 which corresponds to Reimann-Zeta. However, for torch.specia.zeta, I made it mandatory cause for me it feels odd without q this is Reimann-Zeta and with q it is the general Hurwitz Zeta. I think sticking to just general made more sense as passing 1 for q sounds trivial.

Verify:

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jun 8, 2021

💊 CI failures summary and remediations

As of commit a5aa475 (more details on the Dr. CI page and at hud.pytorch.org/pr/59623):


  • 3/3 failures possibly* introduced in this PR
    • 1/3 non-scanned 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_cuda11_1_cudnn8_py3_gcc7_build (1/1)

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

Jun 24 00:03:41 rm: cannot remove '/var/lib/jenkins/sccache_error.log': No such file or directory
Jun 24 00:03:41 ++++ extract_trap_cmd
Jun 24 00:03:41 ++++ printf '%s\n' ''
Jun 24 00:03:41 +++ printf '%s\n' cleanup
Jun 24 00:03:41 ++ trap -- '
Jun 24 00:03:41 cleanup' EXIT
Jun 24 00:03:41 ++ [[ pytorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7-build != *pytorch-win-* ]]
Jun 24 00:03:41 ++ which sccache
Jun 24 00:03:41 ++ sccache --stop-server
Jun 24 00:03:41 ++ true
Jun 24 00:03:41 ++ rm /var/lib/jenkins/sccache_error.log
Jun 24 00:03:41 rm: cannot remove '/var/lib/jenkins/sccache_error.log': No such file or directory
Jun 24 00:03:41 ++ true
Jun 24 00:03:41 ++ [[ -n '' ]]
Jun 24 00:03:41 ++ [[ pytorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7-build == *rocm* ]]
Jun 24 00:03:41 ++ SCCACHE_ERROR_LOG=/var/lib/jenkins/sccache_error.log
Jun 24 00:03:41 ++ SCCACHE_IDLE_TIMEOUT=1200
Jun 24 00:03:41 ++ RUST_LOG=sccache::server=error
Jun 24 00:03:41 ++ sccache --start-server
Jun 24 00:03:41 sccache: Starting the server...
Jun 24 00:03:41 ++ sccache --zero-stats
Jun 24 00:03:41 Compile requests                      0

1 failure not recognized by patterns:

Job Step Action
CircleCI pytorch_linux_bionic_py3_8_gcc9_coverage_test1 Run tests 🔁 rerun

1 job timed out:

  • pytorch_linux_xenial_cuda11_1_cudnn8_py3_gcc7_build

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

Click here to manually regenerate this comment.

@kshitij12345 kshitij12345 mentioned this pull request Jun 9, 2021
17 tasks
@kshitij12345 kshitij12345 added the module: special Functions with no exact solutions, analogous to those in scipy.special label Jun 10, 2021
rtol, atol = None, None
if self.device_type == 'cpu':
rtol, atol = 1e-6, 1e-6
self.assertEqual(expected, actual, rtol=rtol, atol=atol, exact_dtype=False)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

cc @pmeier for yet another example of binary elementwise testing we should automate

@kshitij12345 kshitij12345 marked this pull request as ready for review June 18, 2021 12:42
@kshitij12345 kshitij12345 requested a review from mruberry June 18, 2021 12:43
@gchanan gchanan added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 18, 2021
supports_autograd=False,
safe_casts_outputs=True,
sample_inputs_func=sample_inputs_binary_pwise),
# OpInfo entry to verify the gradient formula of `other`/`q`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Smart.

One goal of our "writing ops in Python" project (which we're looking at for H2 2021) is to simplify supporting scalar x tensor and tensor x scalar operations, possibly by automating the generation of those functions

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Another great, thorough, careful PR @kshitij12345!

@mruberry
Copy link
Collaborator

@kshitij12345 would you just merge this and ping me?

@facebook-github-bot
Copy link
Contributor

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

@kshitij12345
Copy link
Collaborator Author

@mruberry Done :)

@facebook-github-bot
Copy link
Contributor

@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 dfd2edc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged module: special Functions with no exact solutions, analogous to those in scipy.special 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.

5 participants