From 9db9a0b59b0af7053e7c964fb811e0500d29e43b Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 9 May 2024 09:43:28 -0400 Subject: [PATCH] Add test. This one uses a plain array that eventually gets converted to a tensor. --- .../cast/python/ml/test/TestTensorflow2Model.java | 5 +++++ .../data/tf2_test_reshape3.py | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 com.ibm.wala.cast.python.test/data/tf2_test_reshape3.py 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 df0c7f89..2133c4c8 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 @@ -3619,6 +3619,11 @@ public void testReshape2() throws ClassHierarchyException, CancelException, IOEx test("tf2_test_reshape2.py", "f", 1, 1, 2); } + @Test + public void testReshape3() throws ClassHierarchyException, CancelException, IOException { + test("tf2_test_reshape3.py", "f", 1, 1, 2); + } + private void test( String filename, String functionName, diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_reshape3.py b/com.ibm.wala.cast.python.test/data/tf2_test_reshape3.py new file mode 100644 index 00000000..ed12f028 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/tf2_test_reshape3.py @@ -0,0 +1,13 @@ +# https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/reshape + +import tensorflow as tf + + +def f(a): + pass + + +t1 = [[1, 2, 3], [4, 5, 6]] + +t2 = tf.reshape(t1, [6]) +f(t2)