import tensorflow as tf
from tensorflow import keras
def props_to_onehot(props):
# props为概率输出
indices = np.argmax(props,axis=-1)
categorical_labels = keras.utils.to_categorical(indices, num_classes=props.shape[-1])
return categorical_labels
sortmax 结果转 onehot (tensorflow2.0)
最新推荐文章于 2022-06-02 15:27:35 发布