code: def learn(self, state, action, td_error):
      with tf.GradientTape() as tape:
          _logits = self.model(np.array([state]))
          ## cross-entropy loss weighted by td-error (advantage),
          # the cross-entropy mearsures the difference of two probability distributions: the predicted logits and sampled action distribution,
          # then weighted by the td-error: small difference of real and predict actions for large td-error (advantage); and vice versa.
          _exp_v = tl.rein.cross_entropy_reward_loss(
              logits=_logits, actions=[action], rewards=td_error[0]
          )
      grad = tape.gradient(_exp_v, self.model.trainable_weights)
      self.optimizer.apply_gradients(
          zip(grad, self.model.trainable_weights)
      )
      return _exp_v
  
imports: import argparse
  import time
  import matplotlib.pyplot
  import os
  import gym
  import numpy
  import tensorflow
  import tensorlayer
label_desc: Use image node_id 2 for calling the Actor obj's underlying member method code with example usage: obj.learn(state, action, td_error) and returns: _exp_v