NameError: name 'label_train' is not defined

错误地点

        for step in range(501):
            feature_train_batch, label_train_batch = next_batch(feature_train, label_train,1000)  # 随机梯度下降训练,每次选大小为1000的batch
            feature_test_batch, label_test_batch = next_batch(feature_test, label_test,1000)  # 随机梯度下降训练,每次选大小为1000的batch
            sess.run(train_step, feed_dict={xs: feature_train_batch, ys: label_train_batch, keep_prob: 0.5})

        再把定义的next_batch函数发出来,求指教啊         
def next_batch(feature_list,label_list,size):
    feature_batch_temp=[]
    label_batch_temp=[]
    f_list = random.sample(range(len(feature_list)), size)
    for i in f_list:
        feature_batch_temp.append(feature_list[i])
    for i in f_list:
        label_batch_temp.append(label_list[i])
    return feature_batch_temp,label_batch_temp
查看全部
lanjiuling
lanjiuling
2018/12/20 16:07
  • python
  • tensorflow
  • 深度学习
  • 神经网络
  • 点赞
  • 收藏
  • 回答
    私信

2个回复