# Path: flaxformer/components/relative_position_biases.py
# class RelativePositionBiases(nn.Module):
#   def _relative_position_bucket(relative_position,
#                                 bidirectional=True,
#                                 num_buckets=32,
#                                 max_distance=128):
#   def __call__(self, qlen, klen, bidirectional=True, decode=False):


from absl.testing import absltest
from jax import random
from flaxformer.components import relative_position_biases
import jax
import jax.numpy as jnp
import numpy as np
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for relative_position_biases.

"""



class RelativePositionBiasesTest(absltest.TestCase):

  def setUp(self):
    self.num_heads = 3
    self.query_len = 5
    self.key_len = 7

# Path: flaxformer/components/relative_position_biases.py
# class RelativePositionBiases(nn.Module):
#   def _relative_position_bucket(relative_position,
#                                 bidirectional=True,
#                                 num_buckets=32,
#                                 max_distance=128):
#   def __call__(self, qlen, klen, bidirectional=True, decode=False):


# Path: flaxformer/components/relative_position_biases_test.py
from absl.testing import absltest
from jax import random
from flaxformer.components import relative_position_biases
import jax
import jax.numpy as jnp
import numpy as np

# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for relative_position_biases.

"""



class RelativePositionBiasesTest(absltest.TestCase):

  def setUp(self):
    self.num_heads = 3
    self.query_len = 5
    self.key_len = 7

    self.relative_attention = relative_position_biases.RelativePositionBiases(