T - data type for diagonal() output@Operator public final class DiagPart<T> extends PrimitiveOp implements Operand<T>
This operation returns a tensor with the `diagonal` part of the `input`. The `diagonal` part is computed as follows:
Assume `input` has dimensions `[D1,..., Dk, D1,..., Dk]`, then the output is a tensor of rank `k` with dimensions `[D1,..., Dk]` where:
`diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]`.
For example:
# '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]
operation| Modifier and Type | Method and Description |
|---|---|
Output<T> |
asOutput()
Returns the symbolic handle of a tensor.
|
static <T> DiagPart<T> |
create(Scope scope,
Operand<T> input)
Factory method to create a class to wrap a new DiagPart operation to the graph.
|
Output<T> |
diagonal()
The extracted diagonal.
|
equals, hashCode, toStringpublic static <T> DiagPart<T> create(Scope scope, Operand<T> input)
scope - current graph scopeinput - Rank k tensor where k is even and not zero.public Output<T> asOutput()
OperandInputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.
asOutput in interface Operand<T>OperationBuilder.addInput(Output)Copyright © 2015–2019. All rights reserved.