numpy生成Onehot

1
2
3
4
5
6
7
8
import numpy as np

a = [9,2,0]

a_onehot = np.eye(10)[a]


print(a_onehot)

转载请注明来源 https://tianweiye.github.io