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

AttributeError: 'Conv2D' object has no attribute 'apply' #247

Open
JosephMPedersen opened this issue May 23, 2022 · 2 comments
Open

AttributeError: 'Conv2D' object has no attribute 'apply' #247

JosephMPedersen opened this issue May 23, 2022 · 2 comments

Comments

@JosephMPedersen
Copy link

I'm not sure if I'm doing something wrong, but I just ran: pip install tensorflow-privacy
then: python mnist_dpsgd_tutorial.py

And I'm getting the error:

File "/privacy/tutorials/mnist_dpsgd_tutorial_common.py", line 23, in get_cnn_model

y = tf.keras.layers.Conv2D(
16, 8, strides=2, padding='same', activation='relu').apply(input_layer)

AttributeError: 'Conv2D' object has no attribute 'apply'

Here are the versions of the modules that I have installed:

tensorboard 2.9.0 pypi_0 pypi
tensorboard-data-server 0.6.1 pypi_0 pypi
tensorboard-plugin-wit 1.6.0 py_0
tensorflow 2.9.1 pypi_0 pypi
tensorflow-datasets 4.5.2 pypi_0 pypi
tensorflow-estimator 2.9.0 pypi_0 pypi
tensorflow-gpu 2.4.1 h30adc30_0
tensorflow-io-gcs-filesystem 0.26.0 pypi_0 pypi
tensorflow-metadata 1.8.0 pypi_0 pypi
tensorflow-privacy 0.8.0 pypi_0 pypi
tensorflow-probability 0.15.0 pypi_0 pypi

@JosephMPedersen
Copy link
Author

Ok, I found that remove all of the ".apply" fixes the code. I'm not sure if I'm using an incompatible version of tensorflow, maybe Conv2D( ) use to return something with an apply( ) method, but for dependencies the page just states "installing TensorFlow (>= 1.14) is a pre-requisite", and I'm using 2.9.0

@peter-martin-17
Copy link

what does your code look like once you remove ".apply"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants