0
import tensorflow as tf
import numpy as np
x = tf.sparse_placeholder(tf.float32)
y = tf.sparse_reduce_sum(x)
with tf.Session() as sess:
indices = np.array([0, 1], dtype=np.int64)
values = np.array([1.5, 3.0], dtype=np.float32)
shape = np.array([2], dtype=np.int64)
print(sess.run(y, feed_dict={
x: tf.SparseTensorValue(indices, values, shape)}))
このコードは、次のエラーがスローされます。
ValueError: Cannot feed value of shape (2,) for Tensor u'Placeholder_2:0', which has shape '(?, ?)'
私が間違っている形状を渡すだろうか?