Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit call() for models/layers not working #106

Open
tatianacv opened this issue Nov 30, 2023 · 3 comments
Open

Implicit call() for models/layers not working #106

tatianacv opened this issue Nov 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@tatianacv
Copy link
Contributor

Bug in processing the call for call(...) when calling the model (line 36)

class SequentialModel(tf.keras.Model):
def __init__(self, **kwargs):
super(SequentialModel, self).__init__(**kwargs)
self.flatten = tf.keras.layers.Flatten(input_shape=(28, 28))
# Add a lot of small layers
num_layers = 100
self.my_layers = [tf.keras.layers.Dense(64, activation="relu")
for n in range(num_layers)]
self.dropout = tf.keras.layers.Dropout(0.2)
self.dense_2 = tf.keras.layers.Dense(10)
def call(self, x):
x = self.flatten(x)
for layer in self.my_layers:
x = layer(x)
x = self.dropout(x)
x = self.dense_2(x)
return x
input_data = tf.random.uniform([20, 28, 28])
model = SequentialModel()
result = model(input_data)

Similar to #24 for __call__, the call(..) method does not appear in the callgraph.

@tatianacv tatianacv changed the title Implicit call() for Model Implicit call() for Model not working Nov 30, 2023
@khatchad
Copy link
Collaborator

khatchad commented Nov 30, 2023 via email

@tatianacv
Copy link
Contributor Author

Can you change the comment for test 2 to refer to this new issue instead of #24?

ponder-lab#59

@khatchad
Copy link
Collaborator

khatchad commented Dec 3, 2023

Since the super class __call__() calls the subclass' __call__(), this is most likely blocked on #107.

@khatchad khatchad added the bug Something isn't working label Dec 3, 2023
@khatchad khatchad self-assigned this Dec 4, 2023
khatchad added a commit that referenced this issue Dec 4, 2023
Make the comment for test `tf2_test_model_call2` refer to the correct issue #106

Co-authored-by: Raffi Khatchadourian <raffi.khatchadourian@hunter.cuny.edu>
khatchad referenced this issue in ponder-lab/ML Dec 6, 2023
khatchad added a commit that referenced this issue Dec 6, 2023
@khatchad khatchad removed their assignment Dec 6, 2023
khatchad added a commit that referenced this issue Dec 11, 2023
Workaround #106. The real fix should use the XML summaries.
khatchad referenced this issue in ponder-lab/ML Dec 16, 2023
Workaround #106. The real fix should use the XML summaries.
@khatchad khatchad changed the title Implicit call() for Model not working Implicit call() for models/layers not working Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants