我在下面的代码中遇到了一个错误,当我试图用稀疏矩阵乘以稠密矩阵时。在
import tensorflow as tf
import numpy as np
A = tf.sparse_placeholder(tf.float32)
B = tf.sparse_placeholder(tf.float32)
IsFoc = tf.placeholder(tf.float32, [None, 1])
IsFoc_Diag = tf.diag(IsFoc)
IsUnFoc = tf.placeholder(tf.float32, [None, 1])
IsUnFoc_Diag = tf.diag(IsUnFoc)
b = tf.matmul(IsFoc_Diag,IsUnFoc_Diag)
a = tf.matmul(IsFoc_Diag,tf.sparse_tensor_to_dense(A),a_is_sparse=False,b_is_sparse=True)
错误说明:
^{pr2}$我知道也有类似的问题在讨论类似的错误,但是,我不知道这类错误的关键原因。在
错误只发生在a = tf.matmul(IsFoc_Diag,tf.sparse_tensor_to_dense(A),a_is_sparse=False,b_is_sparse=True)
行上。我希望有人能回答我的问题。在
非常感谢!在
目前没有回答
相关问题 更多 >
编程相关推荐