# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved.
#
# 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 ENN Networks."""
from typing import List
from absl.testing import absltest
from absl.testing import parameterized
from enn import supervised
from enn.networks import index_mlp


class NetworkTest(parameterized.TestCase):

  @parameterized.parameters([
      ([], True), ([10, 10], True), ([], False), ([10, 10], False)])
  def test_index_mlp(self, hiddens: List[int], regression: bool):
    """Simple test to run just 10 batches."""
    test_experiment = supervised.make_test_experiment(regression)
    enn = index_mlp.IndexMLPEnn(
        output_sizes=hiddens+[test_experiment.num_outputs],
        index_dim=10,
    )
    experiment = test_experiment.experiment_ctor(enn)
    experiment.train(10)


if __name__ == '__main__':
  absltest.main()
