# Path: enn/losses/vae_losses.py
# def binary_log_likelihood(x: base.Array, output: base.Array) -> float:
# def gaussian_log_likelihood(
#     x: base.Array, mean: base.Array, log_var: base.Array) -> float:
#   def log_normal_prob(x: float, mu: float = 0, sigma: float = 1):
# def latent_kl_divergence(mean: base.Array, log_var: base.Array) -> float:
# def latent_kl_fn(net_out: base.OutputWithPrior) -> float:
# def get_log_likelihood_fn(bernoulli_decoder: bool) -> LogLikelihoodFn:
#   def log_likelihood_fn(net_out: base.OutputWithPrior,
#                         batch: base.Batch) -> float:


from absl.testing import absltest
from absl.testing import parameterized
from enn.losses import vae_losses
import numpy as np
# python3
# 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 vi losses."""



class LossesTest(parameterized.TestCase):

  @parameterized.product(input_size=[1, 10, 100], batch_size=[1, 10])
  def test_binary_log_likelihood(self, input_size: int, batch_size: int):
    """Tests the binary log likelihood."""

    x = np.zeros((batch_size, input_size))
    output = np.zeros_like(x)

# Path: enn/losses/vae_losses.py
# def binary_log_likelihood(x: base.Array, output: base.Array) -> float:
# def gaussian_log_likelihood(
#     x: base.Array, mean: base.Array, log_var: base.Array) -> float:
#   def log_normal_prob(x: float, mu: float = 0, sigma: float = 1):
# def latent_kl_divergence(mean: base.Array, log_var: base.Array) -> float:
# def latent_kl_fn(net_out: base.OutputWithPrior) -> float:
# def get_log_likelihood_fn(bernoulli_decoder: bool) -> LogLikelihoodFn:
#   def log_likelihood_fn(net_out: base.OutputWithPrior,
#                         batch: base.Batch) -> float:


# Path: enn/losses/vae_losses_test.py
from absl.testing import absltest
from absl.testing import parameterized
from enn.losses import vae_losses
import numpy as np

# python3
# 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 vi losses."""



class LossesTest(parameterized.TestCase):

  @parameterized.product(input_size=[1, 10, 100], batch_size=[1, 10])
  def test_binary_log_likelihood(self, input_size: int, batch_size: int):
    """Tests the binary log likelihood."""

    x = np.zeros((batch_size, input_size))
    output = np.zeros_like(x)

    log_likelihood = vae_losses.binary_log_likelihood(x, output)