x_data를 feed_dict로 전달하려고했지만 오류가 발생했습니다. 코드에서 무엇이 잘못되었는지 확신 할 수 없습니다.Tensorflow : 1 차원 데이터의 모양이 일치하지 않습니다.
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'x_12' with dtype int32 and shape [1000]
[[Node: x_12 = Placeholder[dtype=DT_INT32, shape=[1000], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
내 코드 :
import tensorflow as tf
import numpy as np
model = tf.global_variables_initializer()
#define x and y
x = tf.placeholder(shape=[1000],dtype=tf.int32,name="x")
y = tf.Variable(5*x**2-3*x+15,name = "y")
x_data = tf.pack(np.random.randint(0,100,size=1000))
print(x_data)
print(x)
with tf.Session() as sess:
sess.run(model)
print(sess.run(y,feed_dict={x:x_data}))
은 내가 x
및 x_data
의 모양을 확인하고 내가 한 차원 데이터로 작업하고
Tensor("pack_8:0", shape=(1000,), dtype=int32)
Tensor("x_14:0", shape=(1000,), dtype=int32)
동일합니다. 도움을 주시면 감사하겠습니다.