def pooling_func(x): if pooltype == 1: return AveragePooling2D((2, 2), strides=(2, 2))(x) else: return MaxPooling2D((2, 2), strides=(2, 2))(x) # get tensor representations of our images