tensorflow之tf.squeeze()

tf.squeeze () function returns deleted from the tensor of all sizes (szie) is the dimension 1.

Given an input measurement, this operation is the same type of return tensor, and remove all the dimensions of the dimensions 1. If you do not want to delete all size dimensions 1,

You can delete a particular dimension by specifying squeeze_dims.

It is understood by the following examples:

# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]

shape (Squeeze (T)) ==> [2,. 3]   # can be seen, the shape of the dimension 1 are deleted.

 

Or remove specific dimensions:

# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]

shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1]

Guess you like

Origin www.cnblogs.com/elitphil/p/11823982.html