tensorflow中squeeze与expand

tensorflow中squeeze与expand,第1张

tensorflow中squeeze与expand tf.squeeze

z = tf.squeeze(y) #删除y中所有为1的维度;z = tf.squeeze(y,[3,5]) #删除[3,5]中所有为1的维度; tf.expand_dims

tf中没有tf.unsqueeze,一般写tf.expand_dims()扩增维度;one_img = tf.expand_dims(one_img, 0) #第0维插入1维one_img = tf.expand_dims(one_img, -1) #-1表示最后一维

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5701035.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-17
下一篇2022-12-17

发表评论

登录后才能评论

评论列表(0条)

    保存