-
Notifications
You must be signed in to change notification settings - Fork 136
Downstream #1288 #87
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
Closed
Downstream #1288 #87
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a2221ef
remove me
twiecki 43f5884
Initial commit for hyp2f1 op. 4 of 10 tests failing
ColtAllen a7d105d
Revised to ScalarOp n=4 inputs
ColtAllen e8ff5db
Added Hyp2F1 derivatives.
ColtAllen 90cc0de
Added mpmath functions to derivatives and black formatting.
ColtAllen 639902e
Changed grad_not_implemented to NotImplementedError.
ColtAllen ab14213
Added Pochhammer Symbol Op.
ColtAllen acb0101
Added Factorial Op
ColtAllen 464707d
Replaced mpmath functions with scipy
ColtAllen 697d346
changed test inputs from integers to normal for _good_broadcast_unary…
ColtAllen 68e4cac
Updated test values in _good_broadcast_quaternary_hyp2f1
ColtAllen faaa363
set makeBroadcastTester(grad=None) for all tests
ColtAllen 90b3073
Rewrote st_impl for Poch and Factorial in terms of gamma Op
ColtAllen 6a5c595
Refactored Poch and Factorial into helper functions for at.Gamma. Rew…
ColtAllen d071281
Refactored hyp2f1_der in terms of gamma and ran black formatting
ColtAllen 813a290
Moved factorial and poch into tensor.special
ColtAllen 82a7c41
Add Hyp2F1, poch, and factorial
ColtAllen f34a885
Staging commit for hyp2f1 gradient tests
ColtAllen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ def scipy_special_gammal(k, x): | |
expected_iv = scipy.special.iv | ||
expected_erfcx = scipy.special.erfcx | ||
expected_sigmoid = scipy.special.expit | ||
expected_hyp2f1 = scipy.special.hyp2f1 | ||
|
||
TestErfBroadcast = makeBroadcastTester( | ||
op=at.erf, | ||
|
@@ -753,6 +754,73 @@ def test_deprecated_module(): | |
inplace=True, | ||
) | ||
|
||
_good_broadcast_quaternary_hyp2f1 = dict( | ||
normal=( | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 0.5, (2, 3)), | ||
), | ||
) | ||
|
||
_good_broadcast_pentanary_hyp2f1_der = dict( | ||
normal=( | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 0.5, (2, 3)), | ||
integers_ranged(-1, 3, (2, 3)), | ||
), | ||
) | ||
Comment on lines
+766
to
+774
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly you don't need to test this one directly, the Scalar Op will be tested in the test of the |
||
|
||
TestHyp2F1Broadcast = makeBroadcastTester( | ||
op=at.hyp2f1, | ||
expected=expected_hyp2f1, | ||
good=_good_broadcast_quaternary_hyp2f1, | ||
grad=_good_broadcast_quaternary_hyp2f1, | ||
eps=2e-10, | ||
) | ||
|
||
TestHyp2F1InplaceBroadcast = makeBroadcastTester( | ||
op=inplace.hyp2f1_inplace, | ||
expected=expected_hyp2f1, | ||
good=_good_broadcast_quaternary_hyp2f1, | ||
eps=2e-10, | ||
mode=mode_no_scipy, | ||
inplace=True, | ||
) | ||
|
||
_good_broadcast_quaternary_hyp2f1 = dict( | ||
normal=( | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 1000, (2, 3)), | ||
random_ranged(0, 0.5, (2, 3)), | ||
), | ||
) | ||
|
||
TestHyp2F1Broadcast = makeBroadcastTester( | ||
op=at.hyp2f1, | ||
expected=expected_hyp2f1, | ||
good=_good_broadcast_quaternary_hyp2f1, | ||
eps=2e-10, | ||
mode=mode_no_scipy, | ||
) | ||
|
||
TestHyp2F1InplaceBroadcast = makeBroadcastTester( | ||
op=inplace.hyp2f1_inplace, | ||
expected=expected_hyp2f1, | ||
good=_good_broadcast_quaternary_hyp2f1, | ||
eps=2e-10, | ||
inplace=True, | ||
) | ||
|
||
TestHyp2F1DerBroadcast = makeBroadcastTester( | ||
op=at.hyp2f1_der, | ||
expected=expected_hyp2f1, | ||
good=_good_broadcast_pentanary_hyp2f1_der, | ||
eps=2e-10, | ||
) | ||
|
||
class TestBetaIncGrad: | ||
def test_stan_grad_partial(self): | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to provide this as an Elemwise. It's enough to implement the Scalar Op which will be used in the gradient of
hyp2f1
. We don't expect users to use this directly.