Answer the question
In order to leave comments, you need to log in
How to defeat you must feed a value for placeholder tensor (TensorFlow)?
Is there a code that says something like this
#learning parameters
learningRate = 0.01
trainingIteration = 30
batch_size = 100
x = tf.placeholder(tf.float32, [batch_size, 36], name='x')
W = tf.Variable(tf.zeros([36, batch_size]))
b = tf.Variable([0.1], name='bias')
y = tf.placeholder(tf.float32, [batch_size, 1], name='y')
with tf.name_scope('linearModel') as scope:
linear_model = tf.identity(tf.matmul(x, W) + b)
# ...
# ...
# ...
with tf.Session() as sess:
init = tf.global_variables_initializer()
sess.run(init)
for iteration in range(trainingIteration):
avg_cost = 0.
batch_list = []
for i in range(batch_size):
rand = randint(0, len(dataset))
batch_list.append(dataset[rand])
dataDict = dataset[rand]
datasetX = [*map(lambda data: data['inData'], batch_list)]
datasetY = [*map(lambda data: [data['outData']], batch_list)]
sess.run(optimizer, feed_dict = {x: datasetX, y: datasetY})
if iteration % 10 == 0:
print(sess.run(x))
for i in range(batch_size -1):
rand = randint(0, len(dataset))
batch_list.append(dataset[rand])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question