Использование tf.split()
:
import tensorflow as tf
tensor = tf.placeholder(tf.float32, (None, 2, 100, 100, 1024))
splitted = [tf.squeeze(t, axis=1) for t in tf.split(tensor, 2, axis=1)]
print(splitted[0].get_shape().as_list(), splitted[1].get_shape().as_list())
# [None, 100, 100, 1024] [None, 100, 100, 1024]
Чтобы объединить обратно:
# manipulate here ...
splitted = [t[:, None, ...] for t in splitted]
res = tf.concat(splitted, axis=1)
print(res.get_shape().as_list()) # [None, 2, 100, 100, 1024]