privacy
privacy copied to clipboard
AttributeError: 'Conv2D' object has no attribute 'apply'
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
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
what does your code look like once you remove ".apply"?