返回张量的对角线部分。
用法
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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
