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 f87dbdbcb..206f9ec0d 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
@@ -990,6 +990,42 @@ public void testModelCall4()
test("tf2_test_model_call4.py", "SequentialModel.__call__", 1, 1, 3);
}
+ @Test
+ public void testModelAttributes()
+ throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
+ test("tf2_test_model_attributes.py", "f", 1, 1, 2);
+ }
+
+ @Test
+ public void testModelAttributes2()
+ throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
+ test("tf2_test_model_attributes2.py", "f", 1, 1, 2);
+ }
+
+ @Test
+ public void testModelAttributes3()
+ throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
+ test("tf2_test_model_attributes3.py", "f", 1, 1, 2);
+ }
+
+ @Test
+ public void testModelAttributes4()
+ throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
+ test("tf2_test_model_attributes4.py", "f", 1, 1, 2);
+ }
+
+ @Test
+ public void testModelAttributes5()
+ throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
+ test("tf2_test_model_attributes5.py", "f", 1, 1, 2);
+ }
+
+ @Test
+ public void testModelAttributes6()
+ throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
+ test("tf2_test_model_attributes6.py", "f", 1, 1, 2);
+ }
+
@Test
public void testCallbacks()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
diff --git a/com.ibm.wala.cast.python.ml/data/tensorflow.xml b/com.ibm.wala.cast.python.ml/data/tensorflow.xml
index 20e381d11..ddcda65b4 100644
--- a/com.ibm.wala.cast.python.ml/data/tensorflow.xml
+++ b/com.ibm.wala.cast.python.ml/data/tensorflow.xml
@@ -45,6 +45,8 @@
+
+
@@ -146,6 +148,9 @@
+
+
+
@@ -729,6 +734,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes.py b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes.py
new file mode 100644
index 000000000..19848e16a
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes.py
@@ -0,0 +1,15 @@
+# From https://github.com/tensorflow/tensorflow/issues/14359#issue-272179775
+
+import tensorflow as tf
+
+
+def f(a):
+ pass
+
+
+a = tf.keras.layers.Input(shape=(64,))
+b = tf.keras.layers.Dense(5)(a)
+model = tf.keras.models.Model(a, b)
+
+for i in model.trainable_weights:
+ f(i)
diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes2.py b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes2.py
new file mode 100644
index 000000000..65348e9e2
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes2.py
@@ -0,0 +1,16 @@
+# From https://github.com/tensorflow/tensorflow/issues/14359#issue-272179775
+
+import tensorflow as tf
+
+
+def f(a):
+ pass
+
+
+inputs = tf.keras.Input(shape=(3,))
+x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs)
+outputs = tf.keras.layers.Dense(5, activation=tf.nn.softmax)(x)
+model = tf.keras.Model(inputs=inputs, outputs=outputs)
+
+for i in model.trainable_weights:
+ f(i)
diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes3.py b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes3.py
new file mode 100644
index 000000000..86b2c84b9
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes3.py
@@ -0,0 +1,17 @@
+# From https://github.com/tensorflow/tensorflow/issues/14359#issue-272179775
+
+import tensorflow as tf
+
+
+def f(a):
+ pass
+
+
+inputs = tf.keras.Input(shape=(3,))
+x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs)
+outputs = tf.keras.layers.Dense(5, activation=tf.nn.softmax)(x)
+model = tf.keras.Model(inputs=inputs, outputs=outputs)
+
+# From https://www.tensorflow.org/guide/keras/transfer_learning#freezing_layers_understanding_the_trainable_attribute
+for i in model.weights:
+ f(i)
diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes4.py b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes4.py
new file mode 100644
index 000000000..800b85c76
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes4.py
@@ -0,0 +1,16 @@
+# From https://github.com/tensorflow/tensorflow/issues/14359#issue-272179775
+
+import tensorflow as tf
+
+
+def f(a):
+ pass
+
+
+a = tf.keras.layers.Input(shape=(64,))
+b = tf.keras.layers.Dense(5)(a)
+model = tf.keras.models.Model(a, b)
+
+# From https://www.tensorflow.org/guide/keras/transfer_learning#freezing_layers_understanding_the_trainable_attribute.
+for i in model.weights:
+ f(i)
diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes5.py b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes5.py
new file mode 100644
index 000000000..71cda261f
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes5.py
@@ -0,0 +1,17 @@
+# From https://github.com/tensorflow/tensorflow/issues/14359#issue-272179775
+
+import tensorflow as tf
+
+
+def f(a):
+ pass
+
+
+inputs = tf.keras.Input(shape=(3,))
+x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs)
+outputs = tf.keras.layers.Dense(5, activation=tf.nn.softmax)(x)
+model = tf.keras.Model(inputs=inputs, outputs=outputs)
+
+# From https://www.tensorflow.org/guide/keras/transfer_learning#freezing_layers_understanding_the_trainable_attribute
+for i in model.non_trainable_weights:
+ f(i)
diff --git a/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes6.py b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes6.py
new file mode 100644
index 000000000..d44ff1c56
--- /dev/null
+++ b/com.ibm.wala.cast.python.test/data/tf2_test_model_attributes6.py
@@ -0,0 +1,16 @@
+# From https://github.com/tensorflow/tensorflow/issues/14359#issue-272179775
+
+import tensorflow as tf
+
+
+def f(a):
+ pass
+
+
+a = tf.keras.layers.Input(shape=(64,))
+b = tf.keras.layers.Dense(5)(a)
+model = tf.keras.models.Model(a, b)
+
+# From https://www.tensorflow.org/guide/keras/transfer_learning#freezing_layers_understanding_the_trainable_attribute.
+for i in model.non_trainable_weights:
+ f(i)