code: def __init__(
      self, tagset_size, use_gpu=False
  ):  # average_batch=False,
      super(CRF, self).__init__()
      print("build CRF...")
      # self.average_batch = average_batch
      self.gpu = use_gpu
  
      self.START_TAG = -2
      self.STOP_TAG = -1
  
      self.tagset_size = tagset_size
  
      # # We add 2 here, because of START_TAG and STOP_TAG
      # self.hidden2tag = nn.Linear(params['hidden_dim'], self.tagset_size + 2)
      # # transitions (f_tag_size, t_tag_size), transition value from f_tag to t_tag
      init_transitions = torch.zeros(
          self.tagset_size + 2, self.tagset_size + 2
      )
      init_transitions[:, self.START_TAG] = -10000.0
      init_transitions[self.STOP_TAG, :] = -10000.0
      if torch.cuda.is_available():
          init_transitions = init_transitions.cuda()
      self.transitions = nn.Parameter(
          init_transitions, requires_grad=True
      )
  
file_path: DeepKE/src/deepke/event_extraction/standard/bertcrf/crf.py
imports: import torch
  import torch.autograd
  import torch.nn
label_desc: Use image node_id 1 to create a new CRF object from inherited base classes: nn with example: obj = CRF(tagset_size, use_gpu)