code: def learn(self, boards, target_pis, target_vs, optimizer):
      # compute model output
      out_log_pi, out_v = self.model(boards)
  
      pi_loss = (
          -paddle.sum(target_pis * out_log_pi) / target_pis.shape[0]
      )
  
      out_v = paddle.reshape(out_v, [-1])
      v_loss = paddle.sum((target_vs - out_v) ** 2) / target_vs.shape[0]
  
      total_loss = pi_loss + v_loss
  
      # compute gradient and do SGD step
      optimizer.clear_grad()
      total_loss.backward()
      optimizer.step()
  
      return total_loss, pi_loss, v_loss
  
file_path: PARL/examples/AlphaZero/alphazero_agent.py
imports: import parl
  import paddle
  import numpy
  from utils import *
  from tqdm import tqdm
  from connect4_model import Connect4Model
label_desc: Use image node_id 2 for calling the AlphaZero obj's underlying member method code with example usage: obj.learn(boards, target_pis, target_vs, optimizer) and returns: total_loss,  pi_loss,  v_loss