diff --git a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java index 72771249e..191c19335 100644 --- a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java +++ b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java @@ -1198,6 +1198,18 @@ public void testRelu() test("tf2_test_relu.py", "f", 1, 1, 2); } + @Test + public void testTFRange() + throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { + test("tf2_test_tf_range.py", "f", 1, 1, 2); + } + + @Test + public void testTFRange2() + throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { + test("tf2_test_tf_range2.py", "f", 1, 1, 2); + } + private void test( String filename, String functionName, diff --git a/com.ibm.wala.cast.python.ml/data/tensorflow.xml b/com.ibm.wala.cast.python.ml/data/tensorflow.xml index 5390dc6a1..c4e4d7101 100644 --- a/com.ibm.wala.cast.python.ml/data/tensorflow.xml +++ b/com.ibm.wala.cast.python.ml/data/tensorflow.xml @@ -463,7 +463,9 @@ - + + + diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_tf_range.py b/com.ibm.wala.cast.python.test/data/tf2_test_tf_range.py new file mode 100644 index 000000000..4c6c94336 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_test_tf_range.py @@ -0,0 +1,17 @@ +# From: https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/range#for_example + +import tensorflow as tf + + +def f(a): + pass + + +start = 3 +limit = 18 +delta = 3 + +r = tf.range(start, limit, delta) + +for i in r: + f(i) diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_tf_range2.py b/com.ibm.wala.cast.python.test/data/tf2_test_tf_range2.py new file mode 100644 index 000000000..d7f2e007a --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_test_tf_range2.py @@ -0,0 +1,13 @@ +# From: https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/range#for_example + +import tensorflow as tf + + +def f(a): + pass + + +r = [tf.constant(3), tf.constant(6), tf.constant(9), tf.constant(12), tf.constant(15)] + +for i in r: + f(i)