diff --git a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java index 09b37ce4d..0ac722db8 100644 --- a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java +++ b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java @@ -185,6 +185,16 @@ public void testTf2() testTf2("tf2oo2.py", "func2", 1, 4, 2); testTf2("tf2oo3.py", "func2", 1, 4, 2); testTf2("tf2oo4.py", "func2", 1, 4, 2); + testTf2("tf2_testing_decorator.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator2.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator3.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator4.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator5.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator6.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator7.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator8.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator9.py", "returned", 1, 3, 2); + testTf2("tf2_testing_decorator10.py", "returned", 1, 3, 2); } private void testTf2( diff --git a/com.ibm.wala.cast.python.ml/data/tensorflow.xml b/com.ibm.wala.cast.python.ml/data/tensorflow.xml index f36c5d6b6..11c54a8db 100644 --- a/com.ibm.wala.cast.python.ml/data/tensorflow.xml +++ b/com.ibm.wala.cast.python.ml/data/tensorflow.xml @@ -10,6 +10,9 @@ + + + @@ -280,6 +283,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator.py new file mode 100644 index 000000000..3b93c4005 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function() +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator10.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator10.py new file mode 100644 index 000000000..4d67053ab --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator10.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(experimental_follow_type_hints=True) +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator2.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator2.py new file mode 100644 index 000000000..2cfc22f8e --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator2.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(reduce_retracing=True) +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator3.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator3.py new file mode 100644 index 000000000..d5844cdf6 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator3.py @@ -0,0 +1,9 @@ +import tensorflow as tf + +@tf.function(input_signature=(tf.TensorSpec(shape=[None], dtype=tf.float32),)) +@tf.function(reduce_retracing=True) +def returned(a): + return a + +a = tf.constant([1.0, 1.0]) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator4.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator4.py new file mode 100644 index 000000000..b80bf0001 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator4.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(autograph=False) +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator5.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator5.py new file mode 100644 index 000000000..ef058547d --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator5.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(jit_compile=True) +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator6.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator6.py new file mode 100644 index 000000000..1251df432 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator6.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(experimental_implements="google.matmul_low_rank_matrix") +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator7.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator7.py new file mode 100644 index 000000000..53899522e --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator7.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(experimental_autograph_options=tf.autograph.experimental.Feature.EQUALITY_OPERATORS) +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator8.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator8.py new file mode 100644 index 000000000..2a67c0753 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator8.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(experimental_relax_shapes=True) +def returned(a): + return a + +a = tf.range(5) +b = returned(a) diff --git a/com.ibm.wala.cast.python.test/data/tf2_testing_decorator9.py b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator9.py new file mode 100644 index 000000000..da579ace4 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_testing_decorator9.py @@ -0,0 +1,8 @@ +import tensorflow as tf + +@tf.function(experimental_compile=True) +def returned(a): + return a + +a = tf.range(5) +b = returned(a)