-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New API and tests for missing operator overloading (#137)
- New API and new operator overloading issue (#81) - New gradient test. - Reduce epochs in test. - Easier to run.
- Loading branch information
Showing
8 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/GradientTape#gradient. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
def f(a): | ||
pass | ||
|
||
|
||
x = tf.ragged.constant([[1.0, 2.0], [3.0]]) | ||
with tf.GradientTape() as g: | ||
g.watch(x) | ||
y = tf.multiply(x, x) | ||
f(g.gradient(y, x)) |
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,11 @@ | ||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/math/multiply#for_example/ | ||
|
||
import tensorflow as tf | ||
|
||
|
||
def f(a): | ||
pass | ||
|
||
|
||
x = tf.constant(([1, 2, 3, 4])) | ||
f(tf.math.multiply(x, x)) |
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,10 @@ | ||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/math/multiply#for_example/ | ||
|
||
import tensorflow as tf | ||
|
||
|
||
def f(a): | ||
pass | ||
|
||
|
||
f(tf.math.multiply(7, 6)) |
14 changes: 14 additions & 0 deletions
14
com.ibm.wala.cast.python.test/data/tf2_test_sparse_softmax_cross_entropy_with_logits.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/versions/r2.9/api_docs/python/tf/nn/sparse_softmax_cross_entropy_with_logits | ||
|
||
import tensorflow as tf | ||
|
||
|
||
def f(a): | ||
pass | ||
|
||
|
||
logits = tf.constant( | ||
[[2.0, -5.0, 0.5, -0.1], [0.0, 0.0, 1.9, 1.4], [-100.0, 100.0, -100.0, -100.0]] | ||
) | ||
labels = tf.constant([0, 3, 1]) | ||
f(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels, logits=logits.numpy())) |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Test https://github.com/wala/ML/issues/136. | ||
|
||
import tensorflow as tf | ||
|
||
|
||
|