code: def test_sequence_accuracy_last_position_zero_weight(self):
      layer = tl.SequenceAccuracy()
      targets = np.array([[0, 1, 0, 0], [1, 0, 1, 0]])
      weights = np.array([[1.0, 1.0, 1.0, 0.0], [1.0, 1.0, 1.0, 0.0]])
  
      # Model gets both sequences right; output in final position would give
      # wrong category but is ignored.
      model_outputs = np.array(
          [
              [[0.9, 0.1], [0.2, 0.8], [0.7, 0.3], [0.35, 0.65]],
              [[0.3, 0.7], [0.8, 0.2], [0.1, 0.9], [0.35, 0.65]],
          ]
      )
      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.6, 0.4]],
              [[0.3, 0.7], [0.8, 0.2], [0.1, 0.9], [0.6, 0.4]],
          ]
      )
      accuracy = layer([model_outputs, targets, weights])
      self.assertEqual(accuracy, 0.5)
  
      # Model gets second-to-last element of each sequence barely wrong.
      model_outputs = np.array(
          [
              [[0.9, 0.1], [0.2, 0.8], [0.48, 0.52], [0.6, 0.4]],
              [[0.3, 0.7], [0.8, 0.2], [0.51, 0.49], [0.6, 0.4]],
          ]
      )
      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 14 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_sequence_accuracy_last_position_zero_weight() without return types