T
- data type for output()
output@Operator(group="linalg") public final class SetDiag<T> extends PrimitiveOp implements Operand<T>
Given `input` and `diagonal`, this operation returns a tensor with the same shape and values as `input`, except for the main diagonal of the innermost matrices. These will be overwritten by the values in `diagonal`.
The output is computed as follows:
Assume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has `k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a tensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where:
* `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`. * `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`.
operation
Modifier and Type | Method and Description |
---|---|
Output<T> |
asOutput()
Returns the symbolic handle of a tensor.
|
static <T> SetDiag<T> |
create(Scope scope,
Operand<T> input,
Operand<T> diagonal)
Factory method to create a class wrapping a new SetDiag operation.
|
Output<T> |
output()
Rank `k+1`, with `output.shape = input.shape`.
|
equals, hashCode, op, toString
public static <T> SetDiag<T> create(Scope scope, Operand<T> input, Operand<T> diagonal)
scope
- current scopeinput
- Rank `k+1`, where `k >= 1`.diagonal
- Rank `k`, where `k >= 1`.public Output<T> asOutput()
Operand
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.
asOutput
in interface Operand<T>
OperationBuilder.addInput(Output)
Copyright © 2022. All rights reserved.