- 博客(2)
- 收藏
- 关注
原创 用python编码实现one_hot,结果有的元素独热码相同
用python编码实现one_hot,结果有的元素独热码相同 错误代码如下: import tensorflow as tf classes=4 labels=tf.constant([1,4,5,0,3,2]) output=tf.one_hot(labels,depth=classes) print(output) 结果如下: tf.Tensor( [[0. 1. 0. 0.] [0. 0. 0. 0.] [0. 0. 0. 0.] [1. 0. 0. 0.] [0. 0. 0. 1.] [0. 0.
2020-11-18 21:27:50 210
原创 tensorflow编码错误:TypeError: unsupported operand type(s) for *: ‘float‘ and ‘NoneType‘
tensorflow 编码出现错误:TypeError: unsupported operand type(s) for *: ‘float’ and ‘NoneType’ 原码如下: import tensorflow as tf w=tf.Variable(tf.constant(5,dtype=float)) #给w赋随机值,初始值为float 5 lr=0.2 #学习率设为0.2 epoch=20 #设置循环迭代次数 for i in range(epoch): #for循环20次对loss函数
2020-11-18 14:38:02 5775 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人