def cross_entropy_reward_loss(logits, actions, rewards):
 cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits, actions)
 loss = tf.reduce_sum(tf.mul(cross_entropy, rewards))
 return loss

def cross_entropy_reward_loss ( logits , actions , rewards ) : cross_entropy = tf . nn . sparse_softmax_cross_entropy_with_logits ( logits , actions ) loss = tf . reduce_sum ( tf . mul ( cross_entropy , rewards ) ) return loss
calculate the loss for policy gradient network .