code: def get_expectation(masked_d_prime, positive=True):
      """
      Args:
          masked_d_prime: Tensor of shape [n_graphs, n_graphs] for global_global,
                          tensor of shape [n_nodes, n_graphs] for local_global.
          positive (bool): Set True if the d_prime is masked for positive pairs,
                          set False for negative pairs.
      """
      log_2 = np.log(2.0)
      if positive:
          score = log_2 - F.softplus(-masked_d_prime)
      else:
          score = F.softplus(-masked_d_prime) + masked_d_prime - log_2
      return score
  
file_path: DIG/dig/sslgraph/method/contrastive/objectives/jse.py
imports: import itertools
  import numpy
  import torch
  import torch.nn.functional
  import torch.nn
label_desc: Use image node_id 5 for calling a global function with example usage: get_expectation(masked_d_prime, positive) and returns: score