Reputation: 1041
I have a following simple code for the purpose of splitting a tensor into three parts along axis=1
sess = tf.Session()
a = tf.constant([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
x, y, z = tf.split(a, 3, axis=1)
print_out_x = tf.Print(x, [x], message='Value of x: ', name='x_value')
print_out_y = tf.Print(y, [y], message='Value of y: ', name='y_value')
print_out_z = tf.Print(z, [z], message='Value of z: ', name='z_value')
sess.run([print_out_x, print_out_y, print_out_z])
print(print_out_x)
print(print_out_y)
print(print_out_z)
I got the output like below
How can I get full of values inside x, y, z instead of ...
by using tf.Print()
? More sepcifically, I want output should be
Value of z: [[3][6][9][12]]
Value of y: [[2][5][8][11]]
Value of x: [[1][4][7][10]]
Upvotes: 0
Views: 1128
Reputation: 17191
You can use the Args: summarize
in the tf.Print()
function to set the number of arguments that need to be printed per intput tensor.
For ex,
tf.Print(x, [x],summarize=x.shape[0], message='Value of x: ', name='x_value')
#Value of x: [[1][4][7][10]]
Upvotes: 2