code: def test_accuracy(self):
      predictions = [[0.5, 0.2, 0.3], [0.1, 0.6, 0.3], [0.5, 0.2, 0.3]]
      logits = [[1, -1, -3], [-3, -1, -2], [9, 8, 8.5]]
      labels = [0, 1, 2]
      self.assertEqual(mia._get_accuracy(predictions, labels), 2 / 3)
      self.assertEqual(mia._get_accuracy(logits, labels), 2 / 3)
      # If accuracy is already present, simply return it.
      self.assertIsNone(mia._get_accuracy(None, labels))
  
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 20 for calling the RunAttacksTest obj's underlying member method code with example usage: obj.test_accuracy() without return types