Closed boyander closed 8 years ago
I've forgot to mention that color_model have multiple output, so in fact this is not a normal merge, because one of the models have N ouputs and the other one has 1 output. How to merge those is my question.
Your function does not output a Keras tensor, but rather a Theano tensor, which cannot be used to define a Model. To output a Keras tensor, wrap your function into a Lambda layer: http://keras.io/layers/core/#lambda
@fchollet It is not working. The same error "Found: Join.0" is given. How should i proceed on that?
Thanks!
output_towers_merge = merge([color_outputs, select_outputs], output_shape=(None, 8, 8, 3), mode=dotpMerge)
lam = Lambda(lambda x: x, output_shape=(8, 8, 3))
lam.build((8, 3, 3))
out = lam(output_towers_merge)
# Create the model
model = Model(input=color_inputs + select_inputs, output=out)
Lambda(dotpMerge, output_shape=...)
@fchollet Same thing Output tensors to a Model must be Keras tensors. Found: Join.0. Don't know where i'm wrong.
lam = Lambda(dotpMerge, output_shape=(8, 8, 3))
lam.build((8, 3, 3))
out = lam([color_outputs, select_outputs])
# Create the model
model = Model(input=color_inputs + select_inputs, output=out)
Please read the documentation.
On 2 July 2016 at 13:11, Marc Pomar Torres notifications@github.com wrote:
@fchollet https://github.com/fchollet Same thing Output tensors to a Model must be Keras tensors. Found: Join.0. Don't know where i'm wrong.
lam = Lambda(dotpMerge, output_shape=(8, 8, 3)) lam.build((8, 3, 3)) out = lam([color_outputs, select_outputs])
Create the model
model = Model(input=color_inputs + select_inputs, output=out)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fchollet/keras/issues/3130#issuecomment-230119836, or mute the thread https://github.com/notifications/unsubscribe/AArWb9GZx94tljzmVUiF9ATz_9qirN6mks5qRsYDgaJpZM4JDuXA .
I got the same problem,
x_u = Input(shape=(96,96,3))
f_u = shared_cnn(x_u)
y_u = do_something(f_u)
y_ut = Dense(output_dim=10)(y_u)
model_pred = Model(x_u, y_ut)
and it told me that
Output tensors to a Model must be Keras tensors. Found: Tensor("add_711:0", shape=(?, 10), dtype=float32)
so what you have to do is to manually add _keras_history
and _keras_shape
to the output Tensor, which sounds stupid but works.
I have no idea on how to add _keras_history and _keras_shape to the output Tensor?
@Lieutenant-Tom Try with mymodel.layers[-1].output._keras_history='',mymodel.layers[-1].output._keras_shape=...
Doing that just like that @DawnMe gives you
layer, node_index, tensor_index = x._keras_history ValueError: not enough values to unpack (expected 3, got 0)
Hi! I am trying to merge two models to train my deepnet. I'm using a function as the merge mode as defined in the API, but keras gave me the following error:
Exception: Output tensors to a Model must be Keras tensors. Found: Join.0
Here's the code i'm using:
Any ideas on what i'm doing wrong? is there any issue with keras related to this? Thanks in advance.