The code gets warning
UserWarning: Update your Model
call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("de...)
But the Tensor function cannot be found in the Keras models.
from keras.layers import Input, Dense
from keras.models import Model
from keras.datasets import mnist
import numpy as np
num_hidden = 16
num_col_img = 28
num_row_img = 28
num_all_img = num_col_img*num_row_img
input_img = Input(shape=(num_all_img, ))
op_encode = Dense(num_hidden, activation='relu')(input_img)
op_decode = Dense(num_all_img, activation='sigmoid')(op_encode)
autoencoder = Model(input=input_img, output=op_decode)
autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy')
Tensor is the type. The warning is about the argument renaming between Keras2 and Keras1
so :
autoencoder = Model(input=input_img, output=op_decode)
become
autoencoder = Model(inputs=input_img, outputs=op_decode)
@Dref360 Great, now I understand. Sorry for not noticing the difference between inputs and input. I thought I need to change the type. Thank you very much.
Yeah, I was confused as well.
Most helpful comment
Tensor is the type. The warning is about the argument renaming between Keras2 and Keras1
so :
autoencoder = Model(input=input_img, output=op_decode)
become
autoencoder = Model(inputs=input_img, outputs=op_decode)