從張量的形狀中刪除大小為 1 的維度。
用法
tf.raw_ops.Squeeze(
input, axis=[], name=None
)
參數
-
input
一個Tensor
。input
要擠壓。 -
axis
ints
的可選列表。默認為[]
。如果指定,僅壓縮列出的尺寸。維度索引從 0 開始。擠壓不是 1 的維度是錯誤的。必須在[-rank(input), rank(input))
範圍內。 -
name
操作的名稱(可選)。
返回
-
一個
Tensor
。具有與input
相同的類型。
給定一個張量 input
,此操作返回一個相同類型的張量,其中刪除了所有大小為 1 的維度。如果您不想刪除所有尺寸 1 的尺寸,您可以通過指定 axis
來刪除特定的尺寸 1 尺寸。
例如:
# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]
shape(squeeze(t)) ==> [2, 3]
或者,要刪除特定尺寸 1 尺寸:
# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]
shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1]
相關用法
- Python tf.raw_ops.Square用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.Size用法及代碼示例
- Python tf.raw_ops.ScatterUpdate用法及代碼示例
- Python tf.raw_ops.ScatterNdUpdate用法及代碼示例
- Python tf.raw_ops.SparseCrossV2用法及代碼示例
- Python tf.raw_ops.ScatterAdd用法及代碼示例
- Python tf.raw_ops.Sub用法及代碼示例
- Python tf.raw_ops.SparseCross用法及代碼示例
- Python tf.raw_ops.SegmentMean用法及代碼示例
- Python tf.raw_ops.ScatterSub用法及代碼示例
- Python tf.raw_ops.StringStrip用法及代碼示例
- Python tf.raw_ops.SparseConcat用法及代碼示例
- Python tf.raw_ops.SparseSegmentSumWithNumSegments用法及代碼示例
- Python tf.raw_ops.SparseMatrixSparseMatMul用法及代碼示例
- Python tf.raw_ops.SparseMatrixOrderingAMD用法及代碼示例
- Python tf.raw_ops.Shape用法及代碼示例
- Python tf.raw_ops.ScatterDiv用法及代碼示例
- Python tf.raw_ops.SparseFillEmptyRows用法及代碼示例
- Python tf.raw_ops.ScatterNdSub用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.Squeeze。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。