We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
to_categorical
1 parent cf023bd commit 266fc8bCopy full SHA for 266fc8b
art/utils.py
@@ -41,7 +41,7 @@ def to_categorical(labels, nb_classes=None):
41
if not nb_classes:
42
nb_classes = np.max(labels) + 1
43
categorical = np.zeros((labels.shape[0], nb_classes), dtype=np.float32)
44
- categorical[np.arange(labels.shape[0]), labels] = 1
+ categorical[np.arange(labels.shape[0]), np.squeeze(labels)] = 1
45
return categorical
46
47
0 commit comments