code: def test_run_attack_trained_sets_membership_scores(self):
      attack_input = AttackInputData(
          logits_train=np.tile([500.0, -500.0], (100, 1)),
          logits_test=np.tile([0.0, 0.0], (50, 1)),
      )
  
      result = mia._run_trained_attack(
          attack_input,
          AttackType.LOGISTIC_REGRESSION,
          balance_attacker_training=True,
      )
      self.assertLen(result.membership_scores_train, 100)
      self.assertLen(result.membership_scores_test, 50)
  
      # Scores for all training (resp. test) examples should be close
      np.testing.assert_allclose(
          result.membership_scores_train,
          result.membership_scores_train[0],
          rtol=1e-3,
      )
      np.testing.assert_allclose(
          result.membership_scores_test,
          result.membership_scores_test[0],
          rtol=1e-3,
      )
      # Training score should be larger than test score, as training set is set
      # to be positive.
      self.assertGreater(
          result.membership_scores_train[0],
          result.membership_scores_test[0],
      )
  
imports: from unittest import mock
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  from tensorflow_privacy.privacy.privacy_tests import epsilon_lower_bound
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import models
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import DataSize
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleSliceSpec
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingFeature
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingSpec
label_desc: Use image node_id 12 for calling the RunAttacksTest obj's underlying member method code with example usage: obj.test_run_attack_trained_sets_membership_scores() without return types