Skip to content

Commit 266fc8b

Browse files
Irina NicolaeIrina Nicolae
authored andcommitted
Correct to_categorical for unsqueezed labels (closes #7)
(cherry picked from commit 7ba14c4) (cherry picked from commit 001b846)
1 parent cf023bd commit 266fc8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

art/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def to_categorical(labels, nb_classes=None):
4141
if not nb_classes:
4242
nb_classes = np.max(labels) + 1
4343
categorical = np.zeros((labels.shape[0], nb_classes), dtype=np.float32)
44-
categorical[np.arange(labels.shape[0]), labels] = 1
44+
categorical[np.arange(labels.shape[0]), np.squeeze(labels)] = 1
4545
return categorical
4646

4747

0 commit comments

Comments
 (0)