-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/ponder-lab/Hybridize-Functi…
- Loading branch information
Showing
28 changed files
with
532 additions
and
10 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...idize.core/src/edu/cuny/hunter/hybridize/core/analysis/CantComputeRecursionException.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package edu.cuny.hunter.hybridize.core.analysis; | ||
|
||
public class CantComputeRecursionException extends Exception { | ||
|
||
private static final long serialVersionUID = 6647237480647044100L; | ||
|
||
public CantComputeRecursionException() { | ||
} | ||
|
||
public CantComputeRecursionException(String message) { | ||
super(message); | ||
} | ||
|
||
public CantComputeRecursionException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public CantComputeRecursionException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public CantComputeRecursionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
} |
This file contains 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 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 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 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
14 changes: 14 additions & 0 deletions
14
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
# @tf.function | ||
def recursive_fn(n): | ||
if n > 0: | ||
return recursive_fn(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
1 change: 1 addition & 0 deletions
1
...cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow==2.9.3 |
15 changes: 15 additions & 0 deletions
15
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion10/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
@tf.function | ||
def recursive_fn(n): | ||
if n > 0: | ||
tf.print('tracing') | ||
return recursive_fn(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
recursive_fn(5) # Warning - multiple tracings |
1 change: 1 addition & 0 deletions
1
...ny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion10/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow==2.9.3 |
22 changes: 22 additions & 0 deletions
22
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion11/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
def recursive_fn(n): | ||
if n > 0: | ||
return recursive_fn(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
def not_recursive_fn(n): | ||
if n > 0: | ||
return abs(n - 1) | ||
elif n <= 0: | ||
return 1 | ||
else: | ||
return recursive_fn(n) | ||
|
||
|
||
not_recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
1 change: 1 addition & 0 deletions
1
...ny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion11/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow==2.9.3 |
14 changes: 14 additions & 0 deletions
14
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion2/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
# @tf.function | ||
def not_recursive_fn(n): | ||
if n > 0: | ||
return abs(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
not_recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
1 change: 1 addition & 0 deletions
1
...uny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion2/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow==2.9.3 |
18 changes: 18 additions & 0 deletions
18
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion3/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported | ||
|
||
import tensorflow as tf | ||
|
||
|
||
def recursive_fn2(n): | ||
if n > 0: | ||
return recursive_fn(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
# @tf.function | ||
def recursive_fn(n): | ||
return recursive_fn2(n) | ||
|
||
|
||
recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
1 change: 1 addition & 0 deletions
1
...uny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion3/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow==2.9.3 |
16 changes: 16 additions & 0 deletions
16
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion4/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported. | ||
|
||
import tensorflow as tf | ||
from nose.tools import assert_raises | ||
|
||
|
||
@tf.function | ||
def recursive_fn(n): | ||
if n > 0: | ||
return recursive_fn(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
with assert_raises(Exception): | ||
recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
2 changes: 2 additions & 0 deletions
2
...uny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion4/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tensorflow==2.9.3 | ||
nose==1.3.7 |
14 changes: 14 additions & 0 deletions
14
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion5/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
@tf.function | ||
def not_recursive_fn(n): | ||
if n > 0: | ||
return abs(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
not_recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
1 change: 1 addition & 0 deletions
1
...uny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion5/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tensorflow==2.9.3 |
20 changes: 20 additions & 0 deletions
20
edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion6/in/A.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# From https://www.tensorflow.org/guide/function#recursive_tffunctions_are_not_supported | ||
|
||
import tensorflow as tf | ||
from nose.tools import assert_raises | ||
|
||
|
||
def recursive_fn2(n): | ||
if n > 0: | ||
return recursive_fn(n - 1) | ||
else: | ||
return 1 | ||
|
||
|
||
@tf.function | ||
def recursive_fn(n): | ||
return recursive_fn2(n) | ||
|
||
|
||
with assert_raises(Exception): | ||
recursive_fn(tf.constant(5)) # Bad - maximum recursion error. |
2 changes: 2 additions & 0 deletions
2
...uny.hunter.hybridize.tests/resources/HybridizeFunction/testRecursion6/in/requirements.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tensorflow==2.9.3 | ||
nose==1.3.7 |
Oops, something went wrong.