1

So I am trying to use fractional max pool in Keras with Lambda wrappers on CIFAR-10,but whenever I try to train the model the runtime dies. Any clues on what's happening? I am using Keras v2.0 with tensorflow backend.

def frac_max_pool(x):
  return tf.nn.fractional_max_pool(x,[1.0,1/sqrt(2),1/sqrt(2),1.0])[0] 

model = Sequential()
model.add(Conv2D(32,(3,3),padding='same',input_shape=x_train.shape[1:]))
model.add(Activation('relu'))
model.add(Conv2D(32,(3,3)))
model.add(Activation('relu'))
model.add(Lambda(frac_max_pool))

model.add(Dropout(0.25))

model.add(Conv2D(64,(3,3),padding='same',input_shape=x_train.shape[1:]))
model.add(Activation('relu'))
model.add(Conv2D(64,(3,3)))
model.add(Activation('relu'))
model.add(Lambda(frac_max_pool))

model.add(Dropout(0.25))

model.add(Flatten())
model.add(Dense(512))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(10))
model.add(Activation('softmax'))

model.compile(loss='categorical_crossentropy',optimizer=opt,metrics= 
['accuracy'])

model.fit(x_train,y_train,batch_size=32,epochs=100,validation_data= 
(x_test,y_test))
Ioannis Nasios
  • 8,292
  • 4
  • 33
  • 55
Sid
  • 71
  • 1
  • 1
  • 7
  • If you could report the error message.. that would help a lot – zwep May 15 '19 at 17:13
  • No error message, the runtime just stops. Also I solved it by adding `sess = tf.Session()` and `K.set_session(sess)` – Sid Aug 01 '19 at 13:30

0 Answers0