Reputation: 749
I am running a workshop with students using Keras, and all of the students have the same anaconda3 installation in windows.
The following code is giving an error for most of the students except 2 of them:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from keras.layers import Input, Dense, Lambda, Layer, Conv3D, MaxPooling3D, Flatten, UpSampling3D, Reshape
from keras.models import Model
from keras import backend as K
from keras import metrics
#from keras.datasets import mnist
batch_size = 100
original_dim = 32000 #dimX x dimY x dimZ
latent_dim = 2
intermediate_dim = 512 #256
epochs = 5
epsilon_std = 1.0
x = Input(shape=(40, 20, 40, 1))
h = Conv3D(16, (3, 3, 3), activation='relu', padding='same')(x)
h = MaxPooling3D((2, 2, 2), padding='same')(h)
>>max_pool3d() got an expected keyword argument 'data_format'
In the documentation, you can see that the function maxpooling3d()
takes other optional parameters like precisely data_format
, but since we are not even specifying it, why are we getting this error? And why is it not consistent through all installations?
Upvotes: 2
Views: 720
Reputation: 53758
It'd be better if you include the full stacktrace to be sure, but it looks like you're using tensorflow backend and the problem is with tensorflow version.
Keras MaxPooling3D
layer invokes tf.nn.max_pool3d
function, which in v0.12 didn't have a data_format
argument. In the latest versions, it has one, that's why keras expects it.
Try to upgrade tensorflow on all machines.
Upvotes: 1