(self, grad, var, indices, indices_counts = None)
| 267 | return x.value() |
| 268 | |
| 269 | def _resource_apply_sparse(self, grad, var, indices, indices_counts = None): |
| 270 | m = self.get_slot(var, "m") |
| 271 | v = self.get_slot(var, "v") |
| 272 | beta1_power, beta2_power = self._get_beta_accumulators() |
| 273 | if isinstance(var, kv_variable_ops.EmbeddingVariable): |
| 274 | global_step = training_util.get_or_create_global_step() |
| 275 | if indices_counts != None: |
| 276 | return training_ops.kv_resource_sparse_apply_adam_with_counts( |
| 277 | var.handle, m.handle, v.handle, |
| 278 | math_ops.cast(beta1_power, grad.dtype), |
| 279 | math_ops.cast(beta2_power, grad.dtype), |
| 280 | math_ops.cast(self._lr_t, grad.dtype), |
| 281 | math_ops.cast(self._beta1_t, grad.dtype), |
| 282 | math_ops.cast(self._beta2_t, grad.dtype), |
| 283 | math_ops.cast(self._epsilon_t, grad.dtype), |
| 284 | grad, indices, global_step, indices_counts, |
| 285 | use_locking=self._use_locking) |
| 286 | else: |
| 287 | return training_ops.kv_resource_sparse_apply_adam( |
| 288 | var.handle, m.handle, v.handle, |
| 289 | math_ops.cast(beta1_power, grad.dtype), |
| 290 | math_ops.cast(beta2_power, grad.dtype), |
| 291 | math_ops.cast(self._lr_t, grad.dtype), |
| 292 | math_ops.cast(self._beta1_t, grad.dtype), |
| 293 | math_ops.cast(self._beta2_t, grad.dtype), |
| 294 | math_ops.cast(self._epsilon_t, grad.dtype), |
| 295 | grad, indices, global_step, |
| 296 | use_locking=self._use_locking) |
| 297 | else: |
| 298 | return self._resource_apply_sparse_shared(grad, var, indices, |
| 299 | self._resource_scatter_add) |
| 300 | |
| 301 | def _finish(self, update_ops, name_scope): |
| 302 | # Update the power accumulators. |
nothing calls this directly
no test coverage detected