轉載自:http://www.javashuo.com/article/p-mvwbjeqv-bq.htmlhtml
tf.squeeze(input, squeeze_dims=None, name=None)spa
從tensor中刪除全部大小是1的維度code
給定張量輸入,此操做返回相同類型的張量,並刪除全部尺寸爲1的尺寸。 若是不想刪除全部大小是1的維度,能夠經過squeeze_dims指定。htm
# 't' is a tensor of shape [1, 2, 1, 3, 1, 1] shape(squeeze(t)) ==> [2, 3] Or, to remove specific size 1 dimensions: # 't' is a tensor of shape [1, 2, 1, 3, 1, 1] shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1]