class_docstr: An implementation for an explainable neural network for natural
  language processing and generating rationales used by that network.
  Based on the paper "Rethinking Cooperative Rationalization: Introspective
  Extraction and Complement Control" by Yu et. al.
code: def _get_advantages(
      self,
      pred_logits,
      anti_pred_logits,
      cls_pred_logits,
      label,
      z,
      neg_log_probs,
      baseline,
      mask,
  ):
      # supervised loss
      prediction_loss = self.loss_func(
          cls_pred_logits, label
      )  # dimensions (batch_size, )
      sup_loss = torch.mean(prediction_loss)
  
      # total loss of accuracy (not batchwise)
      # cls_pred and ver_pred dimensions: (batch_size,)
      _, cls_pred = torch.max(cls_pred_logits, dim=1)
      _, ver_pred = torch.max(pred_logits, dim=1)
  
      prediction = (ver_pred == label).type(torch.FloatTensor)
      pred_consistency = (ver_pred == cls_pred).type(torch.FloatTensor)
  
      _, anti_pred = torch.max(anti_pred_logits, dim=1)
      prediction_anti = (anti_pred == label).type(
          torch.FloatTensor
      ) * self.lambda_anti
  
      if self.use_cuda:
          # prediction, pred_consistency dimensions: (batch_size,)
          prediction = prediction.cuda()
          pred_consistency = pred_consistency.cuda()
          prediction_anti = prediction_anti.cuda()
  
      (
          continuity_loss,
          sparsity_loss,
      ) = self._count_regularization_baos_for_both(
          z, self.target_sparsity, self.count_pieces, mask
      )
  
      continuity_loss = continuity_loss * self.lambda_continuity
      sparsity_loss = sparsity_loss * self.lambda_sparsity
  
      # batch RL reward
      # rewards = (prediction + pred_consistency) *
      #           self.args.lambda_pos_reward -
      #           prediction_anti - sparsity_loss - continuity_loss
      rewards = (
          0.1 * prediction
          + self.lambda_acc_gap * (prediction - prediction_anti)
          - sparsity_loss
          - continuity_loss
      )
  
      advantages = rewards - baseline  # dimensions (batch_size,)
      advantages = Variable(advantages.data, requires_grad=False)
      if self.use_cuda:
          advantages = advantages.cuda()
  
      return (
          sup_loss,
          advantages,
          rewards,
          pred_consistency,
          continuity_loss,
          sparsity_loss,
      )
  
imports: import logging
  import os
  import random
  from collections import deque
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from interpret_text.experimental.common.base_text_model import BaseTextModel
  from torch.autograd import Variable
  from tqdm import tqdm
  from interpret_text.experimental.common.utils_introspective_rationale import generate_data
label_desc: Use image node_id 9 for calling the IntrospectiveRationaleModel obj's underlying member method code with example usage: obj._get_advantages(pred_logits, anti_pred_logits, cls_pred_logits, label, z, neg_log_probs, baseline, mask) and returns: sup_loss,  advantages,  rewards,  pred_consistency,  continuity_loss,  sparsity_loss