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

Commit 394e69a

Browse files
eric-haibin-linleezu
authored andcommitted
[BUGFIX] Avoid using dict for attention cell parameter creation (#1050)
Workaround for apache/mxnet#17056
1 parent aff2921 commit 394e69a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gluonnlp/model/attention_cell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def __init__(self, base_cell, query_units, key_units, value_units, num_heads, us
217217
self._base_cell = base_cell
218218
self._num_heads = num_heads
219219
self._use_bias = use_bias
220-
units = {'query': query_units, 'key': key_units, 'value': value_units}
221-
for name, unit in units.items():
220+
units = [('query', query_units), ('key', key_units), ('value', value_units)]
221+
for name, unit in units:
222222
if unit % self._num_heads != 0:
223223
raise ValueError(
224224
'In MultiHeadAttetion, the {name}_units should be divided exactly'

0 commit comments

Comments
 (0)