TensorDiagPart

public final class TensorDiagPart

Returns the diagonal part of the tensor.

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]
 

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

Output<T>
asOutput()
Returns the symbolic handle of the tensor.
static <T extends TType> TensorDiagPart<T>
create(Scope scope, Operand<T> input)
Factory method to create a class wrapping a new TensorDiagPart operation.
Output<T>
diagonal()
The extracted diagonal.

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "DiagPart"

Public Methods

public Output<T> asOutput ()

Returns the symbolic handle of the tensor.

Inputs 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.

public static TensorDiagPart<T> create (Scope scope, Operand<T> input)

Factory method to create a class wrapping a new TensorDiagPart operation.

Parameters
scope current scope
input Rank k tensor where k is even and not zero.
Returns
  • a new instance of TensorDiagPart

public Output<T> diagonal ()

The extracted diagonal.