2020-10-02

2020-10-02  本文已影响0人  HelloSam
import tensorflow as tf
import numpy as np

# 生成测试集的标签,佯装是一个mnist手写数据集的标签(10分类)(生成5个数据)
y_test = np.random.randint(1,10,size=5).tolist()
print(y_test)

y_test = tf.keras.utils.to_categorical(y_test,num_classes=10)
print(y_test)

输出结果为:


image.png
上一篇 下一篇

猜你喜欢

热点阅读