首页 > 其他 > 详细

tf.squeeze()

时间:2018-05-20 20:01:51      阅读:217      评论:0      收藏:0      [点我收藏+]

转载自:https://www.cnblogs.com/mdumpling/p/8053376.html

  • 原型

      tf.squeeze(input, squeeze_dims=None, name=None)

      从tensor中删除所有大小是1的维度

      给定张量输入,此操作返回相同类型的张量,并删除所有尺寸为1的尺寸。 如果不想删除所有大小是1的维度,可以通过squeeze_dims指定。

 

  • 参数解释
  1. input: A Tensor. The input to squeeze. 
  2. squeeze_dims: An optional list of ints. Defaults to []. If specified, only squeezes the dimensions listed. The dimension index starts at 0. It is an error to squeeze a dimension that is not 1. 
  3. name: A name for the operation (optional).

 

  • 示例
# ‘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]

tf.squeeze()

原文:https://www.cnblogs.com/helloworld0604/p/9064239.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!