Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The model expects 2 input arrays, but only received one array. #14

Open
LLCF opened this issue Apr 12, 2017 · 1 comment
Open

The model expects 2 input arrays, but only received one array. #14

LLCF opened this issue Apr 12, 2017 · 1 comment

Comments

@LLCF
Copy link

LLCF commented Apr 12, 2017

I have updated this code to Keras2, but met a problem.

with tf.device('/cpu:0'):
	merged = outputs_all[0]
	for outputs in outputs_all[1:]:
		print(outputs)
		merged.append(K.concatenate(outputs, axis=0))
	print(merged)

print

[<tf.Tensor 'tower_0/sequential_1/dropout_2/cond/Merge:0' shape=(?, 101) dtype=float32>, <tf.Tensor 'tower_1/sequential_1/dropout_2/cond/Merge:0' shape=(?, 101) dtype=float32>]

and got an error

ValueError: The model expects 2 input arrays, but only received one array. Found: array with shape (48, 101)

Could I merge two tf.Tensors to one tf.Tensor?

@bzamecnik
Copy link

bzamecnik commented Aug 22, 2017

merged contains a list of merged outputs (since the basic model can have multiple outputs. Each output should be a single Tensor concatenated from the replicas. In this case it seems that the replica outputs were not concatenated together (each element in the list contains a Tensor from a different replica).

What looks a bit strange is the usage of K.concatenate() instead of keras.layers.merge.concatenate().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants