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

[BUGFIX] avoid using dict for attention cell parameter creation #1050

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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