Keras: Use the same layer in different models (share weights)

Oh, nevermind.

I should have read the entire functional API: https://keras.io/getting-started/functional-api-guide/#shared-layers

Here's one of the predictions (maybe still lacking some training): enter image description here

I'm guessing this could be a 3 ? Well at least it works now.

And for those with similar problems, here's the updated code:

inputs=Input((784,))
encode=Dense(10, input_shape=[784])(inputs)
decode=Dense(784, input_shape=[10])

model=Model(input=inputs, output=decode(encode))


model.compile(loss="mse",
             optimizer="adadelta",
             metrics=["accuracy"])

inputs_2=Input((10,))
decode_model=Model(input=inputs_2, output=decode(inputs_2))

I only compiled one of the models. For training you need to compile a model, for prediction that is not necessary.