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)
最新推荐文章于 2024-07-25 17:32:42 发布