def _reduce_to(self, reduce_op, value, destinations): self._verify_destinations_not_different_worker(destinations) if not isinstance(value, values.DistributedValues): # pylint: disable=protected-access return mirrored_strategy._reduce_non_distributed_value( self, reduce_op, value, destinations) return self._cross_device_ops.reduce( reduce_op, value, destinations=destinations)
def _reduce(self, aggregation, value, destinations): self._verify_destinations_not_different_worker(destinations) if not isinstance(value, values.DistributedValues): # pylint: disable=protected-access return mirrored_strategy._reduce_non_distributed_value( self, aggregation, value, destinations) if aggregation == vs.VariableAggregation.ONLY_FIRST_TOWER: return self.broadcast(value.get(self._compute_devices[0]), destinations) return self._cross_tower_ops.reduce( aggregation, value, destinations=destinations)
def _reduce(self, aggregation, value, destinations): self._verify_destinations_not_different_worker(destinations) if not isinstance(value, values.DistributedValues): # pylint: disable=protected-access return mirrored_strategy._reduce_non_distributed_value( self, aggregation, value, destinations) if aggregation == vs.VariableAggregation.ONLY_FIRST_REPLICA: return self.broadcast(value.get(self._compute_devices[0]), destinations) return self._cross_tower_ops.reduce( aggregation, value, destinations=destinations)
def _reduce(self, reduce_op, value, destinations): self._verify_destinations_not_different_worker(destinations) if not isinstance(value, values.DistributedValues): # pylint: disable=protected-access return mirrored_strategy._reduce_non_distributed_value( self, reduce_op, value, destinations) if reduce_op == reduce_util.ReduceOp.ONLY_FIRST_REPLICA: return self.broadcast(value.get(self._compute_devices[0]), destinations) return self._cross_tower_ops.reduce(reduce_op, value, destinations=destinations)