code: def test_sequence_accuracy_weights_all_ones(self):
      layer = tl.SequenceAccuracy()
      targets = np.array([[0, 1, 0, 1], [1, 0, 1, 1]])
      weights = np.ones_like(targets)
  
      # Model gets both sequences right; for each position in each sequence, the
      # category (integer ID) selected by argmax matches the target category.
      model_outputs = np.array(
          [
              [[0.9, 0.1], [0.2, 0.8], [0.7, 0.3], [0.4, 0.6]],
              [[0.3, 0.7], [0.8, 0.2], [0.1, 0.9], [0.4, 0.6]],
          ]
      )
      accuracy = layer([model_outputs, targets, weights])
      self.assertEqual(accuracy, 1.0)
  
      # Model gets the first element of the first sequence barely wrong.
      model_outputs = np.array(
          [
              [[0.45, 0.55], [0.2, 0.8], [0.7, 0.3], [0.4, 0.6]],
              [[0.3, 0.7], [0.8, 0.2], [0.1, 0.9], [0.4, 0.6]],
          ]
      )
      accuracy = layer([model_outputs, targets, weights])
      self.assertEqual(accuracy, 0.5)
  
      # Model gets the last element of each sequence barely wrong.
      model_outputs = np.array(
          [
              [[0.9, 0.1], [0.2, 0.8], [0.7, 0.3], [0.55, 0.45]],
              [[0.3, 0.7], [0.8, 0.2], [0.1, 0.9], [0.52, 0.48]],
          ]
      )
      accuracy = layer([model_outputs, targets, weights])
      self.assertEqual(accuracy, 0.0)
  
imports: from absl.testing import absltest
  import numpy
  import trax.layers
label_desc: Use image node_id 13 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_sequence_accuracy_weights_all_ones() without return types