T
- data type for output()
outputpublic final class CrossReplicaSum<T extends Number> extends PrimitiveOp implements Operand<T>
Each instance supplies its own input.
For example, suppose there are 8 TPU instances: `[A, B, C, D, E, F, G, H]`. Passing group_assignment=`[[0,2,4,6],[1,3,5,7]]` sets `A, C, E, G` as group 0, and `B, D, F, H` as group 1. Thus we get the outputs: `[A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H]`.
operation
Modifier and Type | Method and Description |
---|---|
Output<T> |
asOutput()
Returns the symbolic handle of a tensor.
|
static <T extends Number> |
create(Scope scope,
Operand<T> input,
Operand<Integer> groupAssignment)
Factory method to create a class wrapping a new CrossReplicaSum operation.
|
Output<T> |
output()
The sum of all the distributed inputs.
|
equals, hashCode, op, toString
public static <T extends Number> CrossReplicaSum<T> create(Scope scope, Operand<T> input, Operand<Integer> groupAssignment)
scope
- current scopeinput
- The local input to the sum.groupAssignment
- An int32 tensor with shape
[num_groups, num_replicas_per_group]. `group_assignment[i]` represents the
replica ids in the ith subgroup.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 extends Number>
OperationBuilder.addInput(Output)
Copyright © 2022. All rights reserved.