0
$\begingroup$

I have a tensor x of shape (5, 1). I would like to stack 10 copies of it so that I get a tensor of shape (5, 10). In a sort, it would look like [x|..|x]. How to do it the keras way? I have tried the Concatenate layer, but I got an error.

Help is welcome!

$\endgroup$

1 Answer 1

0
$\begingroup$

After many troubles with Concatenate, I simply did:

x = Reshape((5, 1))(x)
t = ones((1, 10))
stacked_x = x @ t

Maths help a lot. Should have thought about it earlier.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.