code: def test_self_adversarial_negative_sampling_extreme(temperature):
      # validate numerical stability
      val = 1e10
  
      labels = np.array([1, 1, 0, 0], dtype=np.int32)
      logit_scores = np.array([-val, val, -val, val], dtype=np.float32)
      scores = expit(logit_scores)
  
      loss_func = SelfAdversarialNegativeSampling(temperature)
      actual_loss = loss_func(
          tf.constant(labels), tf.constant(logit_scores)
      )
  
      def log_sigmoid(x):
          return -np.logaddexp(0, -x)
  
      neg_weights = np.exp(temperature * scores[2:4])
  
      expected_loss = np.array(
          [
              -log_sigmoid(logit_scores[0]),
              -log_sigmoid(logit_scores[1]),
              neg_weights[0]
              / neg_weights.sum()
              * -log_sigmoid(-logit_scores[2]),
              neg_weights[1]
              / neg_weights.sum()
              * -log_sigmoid(-logit_scores[3]),
          ],
          dtype=np.float32,
      )
  
      assert actual_loss == np.mean(expected_loss)
  
file_path: stellargraph/tests/test_losses.py
imports: from stellargraph.losses import *
  import numpy
  import pytest
  import tensorflow
  from scipy.special import softmax, expit
label_desc: Use image node_id 3 for calling a global function with example usage: test_self_adversarial_negative_sampling_extreme(temperature) and returns: unknown