我使用数据来提供我的张量流代码:
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:使用序列设置数组元素。