Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
[BUGFIX] Avoid using dict for attention cell parameter creation (#1050)
Browse files Browse the repository at this point in the history
Workaround for apache/mxnet#17056
  • Loading branch information
eric-haibin-lin authored and leezu committed Dec 16, 2019
1 parent aff2921 commit 394e69a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gluonnlp/model/attention_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def __init__(self, base_cell, query_units, key_units, value_units, num_heads, us
self._base_cell = base_cell
self._num_heads = num_heads
self._use_bias = use_bias
units = {'query': query_units, 'key': key_units, 'value': value_units}
for name, unit in units.items():
units = [('query', query_units), ('key', key_units), ('value', value_units)]
for name, unit in units:
if unit % self._num_heads != 0:
raise ValueError(
'In MultiHeadAttetion, the {name}_units should be divided exactly'
Expand Down

0 comments on commit 394e69a

Please sign in to comment.