tensorflow ValueError:使用序列设置数组元素

时间:2017-06-07 10:37:47

标签: numpy tensorflow

我的数据格式是这样的: enter image description here

我使用数据来提供我的张量流代码:

user_batch = tf.placeholder(tf.int32, shape=[None], name="id_user")
item_batch = tf.placeholder(tf.int32, shape=[None], name="id_item")
tag_batch = tf.placeholder(tf.int32,shape=[3,None],name ="id_tag")
rate_batch = tf.placeholder(tf.float32, shape=[None])

for i in range(EPOCH_MAX * samples_per_batch):
    users, items,tags,rates = next(iter_train)            
    _, pred_batch = sess.run([train_op, infer], feed_dict={user_batch: users,
                                                           item_batch: items,
                                                           tag_batch:tags,
                                                           rate_batch: rates})`

然后它有valueError:

  

文件“/home/ljh/NCF_TF/GMF.py”,第125行,GMF           rate_batch:rates})         文件“/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py”,   第766行,在运行中           run_metadata_ptr)         文件“/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py”,   第937行,在_run           np_val = np.asarray(subfeed_val,dtype = subfeed_dtype)         文件“/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.py",line   531,在asarray       返回数组(a,dtype,copy = False,order = order)ValueError:使用序列设置数组元素。

0 个答案:

没有答案