返回張量的對角線部分。
用法
tf.raw_ops.DiagPart(
input, name=None
)參數
-
input一個Tensor。必須是以下類型之一:bfloat16,half,float32,float64,int32,int64,complex64,complex128。秩 k 張量,其中 k 是偶數而不是零。 -
name操作的名稱(可選)。
返回
-
一個
Tensor。具有與input相同的類型。
此操作返回帶有 input 的 diagonal 部分的張量。 diagonal 部分計算如下:
假設 input 有維度 [D1,..., Dk, D1,..., Dk] ,那麽輸出是一個秩為 k 的張量,維度為 [D1,..., Dk] 其中:
diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik].
例如:
# 'input' is [[1, 0, 0, 0]
[0, 2, 0, 0]
[0, 0, 3, 0]
[0, 0, 0, 4]]
tf.diag_part(input) ==> [1, 2, 3, 4]
相關用法
- Python tf.raw_ops.Diag用法及代碼示例
- Python tf.raw_ops.Dilation2D用法及代碼示例
- Python tf.raw_ops.DecodeGif用法及代碼示例
- Python tf.raw_ops.DepthToSpace用法及代碼示例
- Python tf.raw_ops.DepthwiseConv2dNative用法及代碼示例
- Python tf.raw_ops.DeserializeManySparse用法及代碼示例
- Python tf.raw_ops.Dequantize用法及代碼示例
- Python tf.raw_ops.DeserializeSparse用法及代碼示例
- Python tf.raw_ops.DynamicPartition用法及代碼示例
- Python tf.raw_ops.DataFormatVecPermute用法及代碼示例
- Python tf.raw_ops.DecodeProtoV2用法及代碼示例
- Python tf.raw_ops.DynamicStitch用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.BatchMatMul用法及代碼示例
- Python tf.raw_ops.OneHot用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.GatherV2用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.DiagPart。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
