code: def batch_fn(self, batch_ex):
      (
          batch_title,
          batch_ent_text,
          batch_ent_type,
          batch_rel,
          batch_text,
          batch_tgt_text,
          batch_graph,
      ) = ([], [], [], [], [], [], [])
      batch_raw_ent_text = []
      for ex in batch_ex:
          ex_data = ex.get_tensor(
              self.ent_vocab,
              self.rel_vocab,
              self.text_vocab,
              self.ent_text_vocab,
              self.title_vocab,
          )
          batch_title.append(ex_data["title"])
          batch_ent_text.append(ex_data["ent_text"])
          batch_ent_type.append(ex_data["ent_type"])
          batch_rel.append(ex_data["rel"])
          batch_text.append(ex_data["text"])
          batch_tgt_text.append(ex_data["tgt_text"])
          batch_graph.append(ex_data["graph"])
          batch_raw_ent_text.append(ex_data["raw_ent_text"])
      batch_title = pad(batch_title, out_type="tensor")
      batch_ent_text, ent_len = pad(
          batch_ent_text, out_type="tensor", flatten=True
      )
      batch_ent_type = pad(batch_ent_type, out_type="tensor")
      batch_rel = pad(batch_rel, out_type="tensor")
      batch_text = pad(batch_text, out_type="tensor")
      batch_tgt_text = pad(batch_tgt_text, out_type="tensor")
      batch_graph = dgl.batch(batch_graph)
      batch_graph.to(self.device)
      return {
          "title": batch_title.to(self.device),
          "ent_text": batch_ent_text.to(self.device),
          "ent_len": ent_len,
          "ent_type": batch_ent_type.to(self.device),
          "rel": batch_rel.to(self.device),
          "text": batch_text.to(self.device),
          "tgt_text": batch_tgt_text.to(self.device),
          "graph": batch_graph,
          "raw_ent_text": batch_raw_ent_text,
      }
  
imports: import json
  import pickle
  import random
  import dgl
  import numpy
  import torch
label_desc: Use image node_id 5 for calling the GWdataset obj's underlying member method code with example usage: obj.batch_fn(batch_ex) and returns: dict