简体   繁体   English

Tensorflow InvalidArgumentError(请参阅上面的回溯):平面索引不会索引到参数中

[英]Tensorflow InvalidArgumentError (see above for traceback): flat indices does not index into param

I'm using tensorflow to build a recommendationg system using collaborative filtering algorithm. 我正在使用tensorflow使用协作过滤算法来构建Recommendationg系统。

Due to memory usage I have to use sparse matrices. 由于内存占用,我必须使用稀疏矩阵。

#Arbitrary number of items are rated by arbitrary number of users
ratings = tf.sparse_placeholder(tf.float32, shape=[None, None])
ratings = tf.sparse_reorder(ratings)

With my feed_dict, ratings.dense_shape == (45776, 60184) 使用我的feed_dict, ratings.dense_shape == (45776, 60184)

pred = tf.matmul(items_features, user_preferences, name='Prediction') + global_mean

I have hardcoded so pred.shape == (45776, 60184) 我已经硬编码了pred.shape == (45776, 60184)

So how comes when I try to collect predictions to later calculate the cost 那么,当我尝试收集预测以以后计算成本时会怎样

pred_values = tf.gather_nd(pred, ratings.indices)

I get error 我得到错误
InvalidArgumentError (see above for traceback): flat indices[2714679, :] = [48375, 2227] does not index into param (shape: [45776,60184]). InvalidArgumentError(请参见上面的回溯):平面索引[2714679,:] = [48375,2227]不索引到参数中(形状:[45776,60184])。
?

It turns out I did mess up with dimensions. 原来我确实弄乱了尺寸。 I fed indices in the opposite order than I thought, ie, for shape (60184,45776) instead of needed (45776,60184) . 我输入索引的顺序与我想象的相反,即形状(60184,45776)而不是所需的(45776,60184)

Having an error telling that my flat indices[2714679, :] are indexing [48375, 2227] - shape that does not appear - didn't help. 出现错误,提示我的flat indices[2714679, :]正在索引[48375, 2227] -未显示的形状-没有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 InvalidArgumentError(参见上面的回溯):indices [1] = 10不在[0,10]中 - InvalidArgumentError (see above for traceback): indices[1] = 10 is not in [0, 10) CIFAR-10 TensorFlow:InvalidArgumentError(请参阅上面的回溯):logits和标签必须是可广播的 - CIFAR-10 TensorFlow: InvalidArgumentError (see above for traceback): logits and labels must be broadcastable InvalidArgumentError(回溯,请参见上面的内容):张量必须为4-D,且最后为1、3或4,而不是[5,100,100,120] - InvalidArgumentError (see above for traceback): Tensor must be 4-D with last dim 1, 3, or 4, not [5,100,100,120] InvalidArgumentError(请参阅上面的回溯):重整形的输入是具有35000个值的张量,但请求的形状需要7500的倍数 - InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 35000 values, but the requested shape requires a multiple of 7500 在tensorflow中提供占位符回溯:'tensorflow.python.framework.errors_impl.InvalidArgumentError:您必须提供占位符张量的值 - feed placeholder traceback in tensorflow: 'tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor TensorFlow:InvalidArgumentError:In[0] 不是矩阵 - TensorFlow: InvalidArgumentError: In[0] is not a matrix Tensorflow 无效形状(InvalidArgumentError) - Tensorflow invalid shape (InvalidArgumentError) 会话中的输出和feb_dict FailedPreconditionError(请参阅上面的回溯):尝试使用未初始化的值 - output and feeb_dict inside session FailedPreconditionError (see above for traceback): Attempting to use uninitialized value Tensorflow在pycharm上看不到gpu - Tensorflow does not see gpu on pycharm 空回溯是什么意思? - What does a null traceback mean?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM