tf.squeeze

从张量的形状中删除大小为 1 的维度

import tensorflow as tf

a=tf.constant([[[1,2,3,1]]])

print(a.shape)

a1=tf.squeeze(a)

print(a1.shape)
(1, 1, 4)
(4,)

文档链接

posted @ 2022-08-19 22:49  luoganttcc  阅读(5)  评论(0)    收藏  举报