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_continuity(self, z, mask):
      mask_z = z * mask
      seq_lengths = torch.sum(mask, dim=1)
  
      mask_z_ = torch.cat([mask_z[:, 1:], mask_z[:, -1:]], dim=-1)
  
      continuity_ratio = (
          torch.sum(torch.abs(mask_z - mask_z_), dim=-1) / seq_lengths
      )  # dimensions (batch_size,)
  
      return continuity_ratio
  
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 12 for calling the IntrospectiveRationaleModel obj's underlying member method code with example usage: obj._get_continuity(z, mask) and returns: continuity_ratio