-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Open
Labels
module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorsmodule: specialFunctions with no exact solutions, analogous to those in scipy.specialFunctions with no exact solutions, analogous to those in scipy.specialtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
kshitij12345 raised an issue two years ago concerning the fact that pytorch's implementation of the 1st order polygamma function incorrectly produces finite values for negative integers. The issue was closed, but the issue still seems to be present in the latest nightlies and the latest release of pytorch.
n = 1
>>> t = torch.tensor([-1.]) >>> torch.polygamma(1, t) tensor([1.2914e+15]) >>> scipy.special.polygamma(1, t.numpy()) array([inf], dtype=float32) >>> t = torch.tensor([-501.]) >>> torch.polygamma(1, t) tensor([2.0831e+09]) >>> scipy.special.polygamma(1, t.numpy()) array([inf], dtype=float32) >>> t = torch.tensor([-float('inf')]) >>> torch.polygamma(1, t) tensor([nan]) >>> scipy.special.polygamma(1, t.numpy()) array([inf], dtype=float32) >>>n > 1
>>> t = torch.tensor([float('inf')]) >>> torch.polygamma(2, t) tensor([nan]) >>> scipy.special.polygamma(2, t.numpy()) array([-0.], dtype=float32) >>> torch.polygamma(3, t) tensor([nan]) >>> scipy.special.polygamma(3, t.numpy()) array([0.], dtype=float32) >>> torch.polygamma(4, t) tensor([nan]) >>> scipy.special.polygamma(4, t.numpy()) array([-0.], dtype=float32)
_Originally posted in #55357
Metadata
Metadata
Assignees
Labels
module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorsmodule: specialFunctions with no exact solutions, analogous to those in scipy.specialFunctions with no exact solutions, analogous to those in scipy.specialtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module