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

我使用数据来提供我的tensorflow代码:

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:使用序列设置数组元素 .