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 5d3c967ef..09b37ce4d 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
@@ -175,6 +175,16 @@ public void testTf2()
testTf2("tf2ll.py", "add", 2, 3, 2, 3);
testTf2("tf2ll2.py", "add", 2, 3, 2, 3);
testTf2("tf2ll3.py", "add", 2, 3, 2, 3);
+ testTf2("tf2mm.py", "add", 2, 3, 2, 3);
+ testTf2("tf2mm2.py", "add", 2, 3, 2, 3);
+ testTf2("tf2nn.py", "value_index", 2, 4, 2, 3);
+ testTf2("tf2nn2.py", "value_index", 2, 4, 2, 3);
+ testTf2("tf2nn3.py", "value_index", 2, 4, 2, 3);
+ testTf2("tf2nn4.py", "value_index", 2, 4, 2, 3);
+ testTf2("tf2oo.py", "func2", 1, 4, 2);
+ testTf2("tf2oo2.py", "func2", 1, 4, 2);
+ testTf2("tf2oo3.py", "func2", 1, 4, 2);
+ testTf2("tf2oo4.py", "func2", 1, 4, 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 fa8aac78d..f36c5d6b6 100644
--- a/com.ibm.wala.cast.python.ml/data/tensorflow.xml
+++ b/com.ibm.wala.cast.python.ml/data/tensorflow.xml
@@ -35,8 +35,6 @@
-
-
@@ -45,6 +43,9 @@
+
+
+
@@ -63,9 +64,6 @@
-
-
-
@@ -106,6 +104,12 @@
+
+
+
+
+
+
@@ -139,6 +143,13 @@
+
+
+
+
+
+
+
@@ -470,6 +481,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.ibm.wala.cast.python.test/data/tf2mm.py b/com.ibm.wala.cast.python.test/data/tf2mm.py
new file mode 100644
index 000000000..5947fdd98
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2mm.py
@@ -0,0 +1,7 @@
+import tensorflow as tf
+
+def add(a, b):
+ return a + b
+
+
+c = add(tf.keras.layers.Input(shape=(32,)), tf.keras.layers.Input(shape=(32,)))
diff --git a/com.ibm.wala.cast.python.test/data/tf2mm2.py b/com.ibm.wala.cast.python.test/data/tf2mm2.py
new file mode 100644
index 000000000..b904a5082
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2mm2.py
@@ -0,0 +1,7 @@
+import tensorflow
+
+def add(a, b):
+ return a + b
+
+
+c = add(tensorflow.keras.layers.Input(shape=(32,)), tensorflow.keras.layers.Input(shape=(32,)))
diff --git a/com.ibm.wala.cast.python.test/data/tf2nn.py b/com.ibm.wala.cast.python.test/data/tf2nn.py
new file mode 100644
index 000000000..bb2c6dfc5
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2nn.py
@@ -0,0 +1,13 @@
+import tensorflow as tf
+
+def value_index(a,b):
+ return a.value_index + b.value_index
+
+# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated
+g = tf.Graph()
+with g.as_default():
+ # Defines operation and tensor in graph
+ c = tf.constant(30.0)
+ assert c.graph is g
+
+result = value_index(tf.experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32), tf.experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32))
diff --git a/com.ibm.wala.cast.python.test/data/tf2nn2.py b/com.ibm.wala.cast.python.test/data/tf2nn2.py
new file mode 100644
index 000000000..de764dece
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2nn2.py
@@ -0,0 +1,14 @@
+from tensorflow.experimental import numpy
+import tensorflow as tf
+
+def value_index(a,b):
+ return a.value_index + b.value_index
+
+# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated
+g = tf.Graph()
+with g.as_default():
+ # Defines operation and tensor in graph
+ c = tf.constant(30.0)
+ assert c.graph is g
+
+result = value_index(numpy.ndarray(g.get_operations()[0], 0, tf.float32), numpy.ndarray(g.get_operations()[0], 0, tf.float32))
diff --git a/com.ibm.wala.cast.python.test/data/tf2nn3.py b/com.ibm.wala.cast.python.test/data/tf2nn3.py
new file mode 100644
index 000000000..8dcd1a86d
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2nn3.py
@@ -0,0 +1,14 @@
+from tensorflow.experimental.numpy import ndarray
+import tensorflow as tf
+
+def value_index(a,b):
+ return a.value_index + b.value_index
+
+# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated
+g = tf.Graph()
+with g.as_default():
+ # Defines operation and tensor in graph
+ c = tf.constant(30.0)
+ assert c.graph is g
+
+result = value_index(ndarray(g.get_operations()[0], 0, tf.float32), ndarray(g.get_operations()[0], 0, tf.float32))
diff --git a/com.ibm.wala.cast.python.test/data/tf2nn4.py b/com.ibm.wala.cast.python.test/data/tf2nn4.py
new file mode 100644
index 000000000..b569942bc
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2nn4.py
@@ -0,0 +1,14 @@
+from tensorflow import experimental
+import tensorflow as tf
+
+def value_index(a,b):
+ return a.value_index + b.value_index
+
+# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated
+g = tf.Graph()
+with g.as_default():
+ # Defines operation and tensor in graph
+ c = tf.constant(30.0)
+ assert c.graph is g
+
+result = value_index(experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32), experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32))
diff --git a/com.ibm.wala.cast.python.test/data/tf2oo.py b/com.ibm.wala.cast.python.test/data/tf2oo.py
new file mode 100644
index 000000000..3913cd525
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2oo.py
@@ -0,0 +1,14 @@
+import tensorflow as tf
+
+def func2(t):
+ pass
+
+@tf.function
+def func():
+ a = tf.constant([[1.0, 2.0], [3.0, 4.0]])
+ b = tf.constant([[1.0, 1.0], [0.0, 1.0]])
+ c = tf.matmul(a, b)
+ tensor = tf.experimental.numpy.ndarray(c.op, 0, tf.float32)
+ func2(tensor)
+
+func()
diff --git a/com.ibm.wala.cast.python.test/data/tf2oo2.py b/com.ibm.wala.cast.python.test/data/tf2oo2.py
new file mode 100644
index 000000000..ef42ae179
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2oo2.py
@@ -0,0 +1,15 @@
+from tensorflow import experimental
+import tensorflow as tf
+
+def func2(t):
+ pass
+
+@tf.function
+def func():
+ a = tf.constant([[1.0, 2.0], [3.0, 4.0]])
+ b = tf.constant([[1.0, 1.0], [0.0, 1.0]])
+ c = tf.matmul(a, b)
+ tensor = experimental.numpy.ndarray(c.op, 0, tf.float32)
+ func2(tensor)
+
+func()
diff --git a/com.ibm.wala.cast.python.test/data/tf2oo3.py b/com.ibm.wala.cast.python.test/data/tf2oo3.py
new file mode 100644
index 000000000..13021058c
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2oo3.py
@@ -0,0 +1,15 @@
+from tensorflow.experimental import numpy
+import tensorflow as tf
+
+def func2(t):
+ pass
+
+@tf.function
+def func():
+ a = tf.constant([[1.0, 2.0], [3.0, 4.0]])
+ b = tf.constant([[1.0, 1.0], [0.0, 1.0]])
+ c = tf.matmul(a, b)
+ tensor = numpy.ndarray(c.op, 0, tf.float32)
+ func2(tensor)
+
+func()
diff --git a/com.ibm.wala.cast.python.test/data/tf2oo4.py b/com.ibm.wala.cast.python.test/data/tf2oo4.py
new file mode 100644
index 000000000..57bd363de
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2oo4.py
@@ -0,0 +1,15 @@
+from tensorflow.experimental.numpy import ndarray
+import tensorflow as tf
+
+def func2(t):
+ pass
+
+@tf.function
+def func():
+ a = tf.constant([[1.0, 2.0], [3.0, 4.0]])
+ b = tf.constant([[1.0, 1.0], [0.0, 1.0]])
+ c = tf.matmul(a, b)
+ tensor = ndarray(c.op, 0, tf.float32)
+ func2(tensor)
+
+func()