in Education by
I have a DQN all set up and working, but I can't figure out how to display the loss without leaving the Tensorflow session. I first thought it involved creating a new function or class, but I'm not sure where to put it in the code, and what specifically to put into the function or class. observations = tf.placeholder(tf.float32, shape=[None, num_stops], name='observations') actions = tf.placeholder(tf.int32,shape=[None], name='actions') rewards = tf.placeholder(tf.float32,shape=[None], name='rewards') # Model Y = tf.layers.dense(observations, 200, activation=tf.nn.relu) Ylogits = tf.layers.dense(Y, num_stops) # sample an action from predicted probabilities sample_op = tf.random.categorical(logits=Ylogits, num_samples=1) # loss cross_entropies = tf.losses.softmax_cross_entropy(onehot_labels=tf.one_hot(actions,num_stops), logits=Ylogits) loss = tf.reduce_sum(rewards * cross_entropies) # training operation optimizer = tf.train.RMSPropOptimizer(learning_rate=0.001, decay=.99) train_op = optimizer.minimize(loss) I then run the network, which works without error. with tf.Session() as sess: '''etc. The network is run''' sess.run(train_op, feed_dict={observations: observations_list, actions: actions_list, rewards: rewards_list}) I want to have loss from train_op displayed to the user. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
try this loss, _ = sess.run([loss, train_op], feed_dict={observations: observations_list, actions: actions_list, rewards: rewards_list})

Related questions

0 votes
    I was looking at the docs of TensorFlow about tf.nn.conv2d here. But I can't understand what it does or ... it raised the question. Select the correct answer from above options...
asked Jan 27, 2022 in Education by JackTerrance
0 votes
    In tf.nn.max_pool of tensorflow what is the difference between 'SAME' and 'VALID'? I read in here that ... pool means in tensorflow? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    Classification problems, such as logistic regression or multinomial logistic regression, optimize a cross-entropy loss. ... jungle. Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    When I convert a factor to a numeric or integer, I get the underlying level codes, not the values as numbers. f...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    What are some strategies that people have had success with for maintaining a change history for data in a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    What are some strategies that people have had success with for maintaining a change history for data in a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    Firewall examines each ____________ that are entering or leaving the internal network. (a) emails users (b) updates (c ... questions and answers pdf, mcq on Cyber Security pdf,...
asked Nov 4, 2021 in Education by JackTerrance
0 votes
    What is the attenuation in dB assuming I1 is the input current and I2 is the output current leaving the port? ( ... for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    here is my code. var http=require("http"); var fs = require("fs"); var express = require(" ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    I would like to display a twitter user profile without having the app prompt the phone user for creating an ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    without mentioning which of the following for browser to find and display an image? (a) source of the image (b) ... none of the given Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    In the tensorflow documentation at the autograph section we have the following code snippet @tf.function def train ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    In the chapter seven of this book "TensorFlow Machine Learning Cookbook" the author in pre-processing data ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I'm using TensorFlow Alpha 2.0. I have TFRecords files I'm reading from, each one holding a short ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    In the MNIST beginner tutorial, there is the statement accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) tf ... (x,1)? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
...