Skip to content

Commit

Permalink
Correct to_categorical for unsqueezed labels (closes #7)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7ba14c4)
(cherry picked from commit 001b846)
  • Loading branch information
Irina Nicolae authored and Irina Nicolae committed Jun 19, 2018
1 parent cf023bd commit 266fc8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion art/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def to_categorical(labels, nb_classes=None):
if not nb_classes:
nb_classes = np.max(labels) + 1
categorical = np.zeros((labels.shape[0], nb_classes), dtype=np.float32)
categorical[np.arange(labels.shape[0]), labels] = 1
categorical[np.arange(labels.shape[0]), np.squeeze(labels)] = 1
return categorical


Expand Down

0 comments on commit 266fc8b

Please sign in to comment.