0
votes

My keras code is throwing this error:

2021-03-01 08:31:47.267964: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2021-03-01 08:31:47.272086: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. Traceback (most recent call last): File "main.py", line 1, in from train import Train File "D:\Github\tutorials_1_residual_network-master\train.py", line 20, in from network_model import NetworkModel File "D:\Github\tutorials_1_residual_network-master\network_model.py", line 9, in from keras.layers import Dense, MaxPooling2D, Conv2D, Flatten,
ImportError: cannot import name 'Deconvolution2D' from 'keras.layers' (D:\Github\tutorials_1_residual_network-master\venv\lib\site-packages\keras\layers_init_.py)

It seems that Deconvolution2D is not used anymore in keras. What should I use instead?

1
It has been renamed Conv2DTranspose. If you want to import that exact module, you can via from keras.layers.convolutional import Deconvolution2D.gobrewers14

1 Answers

1
votes

You can use this

https://www.tensorflow.org/api_docs/python/tf/keras/layers/Conv2DTranspose

Transposed convolution layer (sometimes called Deconvolution).

tf.keras.layers.Conv2DTranspose(
    filters, kernel_size, strides=(1, 1), padding='valid',
    output_padding=None, data_format=None, dilation_rate=(1, 1), activation=None,
    use_bias=True, kernel_initializer='glorot_uniform',
    bias_initializer='zeros', kernel_regularizer=None,
    bias_regularizer=None, activity_regularizer=None, kernel_constraint=None,
    bias_constraint=None, **kwargs
)

slightly different but also checkout upsampling2d, https://www.tensorflow.org/api_docs/python/tf/keras/layers/UpSampling2D