class_docstr: Tests for utilities in nn_ops.py.
class_docstr_tok: ["Tests","for","utilities","in","nn_ops.py","."]
docstr: Tests compute_relative_positions.
docstr_tok: ["Tests","compute_relative_positions","."]
code: def test_compute_1d_relative_distance(
      self, lenq, lenk, expected_relative_distance
  ):
      """Tests compute_relative_positions."""
      relative_distance = nn_ops.compute_1d_relative_distance(
          lenq, lenk
      )
      # Test output values.
      self.assertTrue(
          np.array_equal(relative_distance, expected_relative_distance)
      )
  
imports: import functools
  from absl.testing import absltest
  from absl.testing import parameterized
  import flax.linen
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.layers import nn_ops
label_desc: Use image node_id 10 for calling the NNOpsTest obj's underlying member method code with example usage: obj.test_compute_1d_relative_distance(lenq, lenk, expected_relative_distance) without return types