-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add summary for
tf.keras.Model
(#158)
Add attributes that are lists of tensors.
- Loading branch information
Showing
8 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
com.ibm.wala.cast.python.test/data/tf2_test_model_attributes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
16 changes: 16 additions & 0 deletions
16
com.ibm.wala.cast.python.test/data/tf2_test_model_attributes2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
17 changes: 17 additions & 0 deletions
17
com.ibm.wala.cast.python.test/data/tf2_test_model_attributes3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
16 changes: 16 additions & 0 deletions
16
com.ibm.wala.cast.python.test/data/tf2_test_model_attributes4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
17 changes: 17 additions & 0 deletions
17
com.ibm.wala.cast.python.test/data/tf2_test_model_attributes5.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
16 changes: 16 additions & 0 deletions
16
com.ibm.wala.cast.python.test/data/tf2_test_model_attributes6.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |