#!/usr/bin/env python3 from keras.utils import np_utils import numpy X = numpy.array([2,1,2,0,1,0]) print("org=", X) onehot=np_utils.to_categorical(X) print("onehot=", onehot) a=onehot.argmax(1) print("reverse=", a)