I have two tensor I want to contact 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? (sorry I am new to tensorflow), 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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.