How do I stack copies of a 1D tensor in keras?

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!

Topic keras tensorflow

Category Data Science


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.