(self, *args, **kwargs)
| 1210 | return self.get().assign_add(*args, **kwargs) |
| 1211 | |
| 1212 | def assign(self, *args, **kwargs): |
| 1213 | with _enter_or_assert_strategy(self._distribute_strategy): |
| 1214 | if distribution_strategy_context.in_cross_replica_context(): |
| 1215 | # To preserve the sum across save and restore, we have to divide the |
| 1216 | # total across all devices when restoring a variable that was summed |
| 1217 | # when saving. |
| 1218 | tensor = args[0] |
| 1219 | if self._aggregation == vs.VariableAggregation.SUM: |
| 1220 | tensor *= 1. / len(self.devices) |
| 1221 | return control_flow_ops.group(tuple( |
| 1222 | _assign_on_device(v.device, v, tensor) for v in self._values)) |
| 1223 | else: |
| 1224 | return self.get().assign(*args, **kwargs) |
| 1225 | |
| 1226 | @property |
| 1227 | def aggregation(self): |
nothing calls this directly
no test coverage detected