Why keras does not allow to add a convolutional layer in this way?

后端 未结 2 1437
有刺的猬
有刺的猬 2021-01-28 01:48

The following code

from tensorflow import keras
from keras.layers import Conv2D

model = keras.Sequential()
model.add(Conv2D(1, (3, 3), padding=\'same\', input_s         


        
2条回答
  •  死守一世寂寞
    2021-01-28 02:09

    You should import Sequential from keras models

    from keras.models import Sequential
    from keras.layers import Conv2D
    
    model = Sequential()
    model.add(Conv2D(1, (3, 3), padding='same', input_shape=(28, 28, 1)))
    

提交回复
热议问题