Reputation: 41
I have two tensor I want to concat in tensorflow.
So the shape of these tensor are :(Bs,dynamics,n_features)
The batch_size
and n_features
are guarantee to be same, so I think this operation is possible.
However, I think tensorflow will run a pre-check? tensorflow will check if two tensor with shape (None, None, n_features)
could be concatenated in axis 1, which is not possible, because it doesn't know what is the result of None+None
Anybody has any idea to this?
Upvotes: 1
Views: 162
Reputation: 26718
Concatenating should not be a problem in your case:
import tensorflow as tf
x1 = tf.random.normal((5, 10, 20))
x2 = tf.random.normal((5, 33, 20))
@tf.function
def concatenate(x1, x2):
return tf.concat([x1, x2], axis=1)
concatenate(x1, x2).shape
Upvotes: 1