From 637f426644eeccbe552a59d1cc6be06fa3afabf3 Mon Sep 17 00:00:00 2001 From: valedica Date: Fri, 11 Mar 2022 13:16:39 +0100 Subject: [PATCH] Fix wrong building of Mention Type one-hot vectors This is done by avoiding slicing and using coordinate indexing instead for the assignment --- neuralcoref/train/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neuralcoref/train/dataset.py b/neuralcoref/train/dataset.py index 0831768..850c516 100644 --- a/neuralcoref/train/dataset.py +++ b/neuralcoref/train/dataset.py @@ -228,7 +228,7 @@ def __getitem__(self, mention_idx, debug=False): [self.mentions[idx.item()][0][np.newaxis, :] for idx in pairs_ant_index] ) ant_features = np.zeros((pairs_length, SIZE_FS - SIZE_GENRE)) - ant_features[:, ant_features_raw[:, 0]] = 1 + ant_features[np.arange(pairs_length), ant_features_raw[:, 0]] = 1 ant_features[:, 4:15] = encode_distance(ant_features_raw[:, 1]) ant_features[:, 15] = ant_features_raw[:, 2].astype(float) / ant_features_raw[ :, 3