Skip to content
Advertisement

Dropping dimension of Tensor with size bigger then one tensor, in Tensorflow

First i splitted the original tensor and then after some operations i want to combine the tensor to the original shape and the original tensor, before splitting it. I’m not sure i can just use the old tensor with graph mode in tensorflow.

Each dimension of the four dimension of tensor_a has at least a size of 2.

JavaScript

Advertisement

Answer

The code below is self-contained, and shows a couple of ways of reconstructing the original tensor after splitting. I think the second approach, using tf.concat() instead of tf_convert_to_tensor() is the neatest. I’m hoping the code is self-explanatory.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement