Skip to content

Commit

Permalink
Automatically fallback to dense updates in Adafactor
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumekln committed Mar 27, 2018
1 parent 3beff36 commit b2df462
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OpenNMT-tf follows [semantic versioning 2.0.0](https://semver.org/). The API cov

* Fix the encoder state structure when RNN encoders are combined (e.g. in `SequentialEncoder`)
* Fix `CharConvEmbedder` error on empty sequences
* Fix `Adafactor` crash on sparse updates, automatically fallback to dense updates instead

## [1.0.1](https://github.com/OpenNMT/OpenNMT-tf/releases/tag/v1.0.1) (2018-03-14)

Expand Down
4 changes: 2 additions & 2 deletions opennmt/utils/adafactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ def _create_slots(self, var_list):

def _apply_dense(self, grad, var):
return self._resource_apply_dense(grad, var)

def _apply_sparse(self, grad, var):
print(grad, var)
raise NotImplementedError()
return self._apply_dense(tf.convert_to_tensor(grad), var)

def _parameter_scale(self, var):
"""Estimate the scale of the parameters from the current values.
Expand Down

0 comments on commit b2df462

Please sign in to comment.