# Path: nn_utils/nerf_layers.py
# class FourierEmbedding(tf.keras.layers.Layer):
#     def __init__(
#         self,
#         num_frequencies: int,
#         include_input: bool = True,
#         input_dim: int = 3,
#         **kwargs
#     ):
#         super(FourierEmbedding, self).__init__(trainable=False, **kwargs)
# 
#         self.input_dims = input_dim
#         self.out_dims = 0
#         self.num_frequencies = num_frequencies
#         self.include_input = include_input
# 
#         if include_input:
#             self.out_dims += input_dim
# 
#         if num_frequencies >= 1:
#             frequency_dims = (
#                 2 * num_frequencies * input_dim
#             )  # 2 (sin, cos) * num_frequencies * num input_dim
#             self.out_dims += frequency_dims
# 
#         self.scales = tf.convert_to_tensor(
#             2.0 ** np.linspace(0.0, self.num_frequencies - 1, self.num_frequencies),
#             tf.float32,
#         )
# 
#     # @tf.function
#     def call(self, x):
#         assert (
#             x.shape[-1] == self.input_dims
#         ), "Channel dimension is %d but should be %d" % (x.shape[-1], self.input_dims)
# 
#         x_shape = tf.shape(x)
# 
#         xb = tf.reshape(
#             x[..., None, :] * self.scales[:, None],
#             tf.concat([x_shape[:-1], self.num_frequencies * x_shape[-1:]], 0),
#         )
# 
#         four_feat = tf.math.sin(tf.concat([xb, xb + 0.5 * np.pi], axis=-1))
# 
#         ret = []
#         if self.include_input:
#             ret += [x]
# 
#         return tf.concat(ret + [four_feat], axis=-1)
# 
#     def get_output_dimensionality(self):
#         return self.out_dims


import tensorflow as tf
from tensorflow.python.keras.engine.input_layer import InputLayer
from nn_utils.nerf_layers import FourierEmbedding
        args,
        input_dimensions: int = 7,
        activation="relu",
        final_activation="linear",
        kernel_initializer="he_uniform",
        bias_initializer=tf.keras.initializers.Zeros,
        **kwargs,
    ):
        super(BrdfDiscriminator, self).__init__(**kwargs)

        net = [tf.keras.Input((input_dimensions,))]
        for _ in range(args.disc_d):
            net.append(
                tf.keras.layers.Dense(
                    args.disc_w,
                    activation=activation,
                    kernel_initializer=kernel_initializer,
                    bias_initializer=bias_initializer,
                )
            )

        net.append(
            tf.keras.layers.Dense(
                1,
                activation=final_activation,
                kernel_initializer=kernel_initializer,
                bias_initializer=bias_initializer,
            )
        )


# Path: nn_utils/nerf_layers.py
# class FourierEmbedding(tf.keras.layers.Layer):
#     def __init__(
#         self,
#         num_frequencies: int,
#         include_input: bool = True,
#         input_dim: int = 3,
#         **kwargs
#     ):
#         super(FourierEmbedding, self).__init__(trainable=False, **kwargs)
# 
#         self.input_dims = input_dim
#         self.out_dims = 0
#         self.num_frequencies = num_frequencies
#         self.include_input = include_input
# 
#         if include_input:
#             self.out_dims += input_dim
# 
#         if num_frequencies >= 1:
#             frequency_dims = (
#                 2 * num_frequencies * input_dim
#             )  # 2 (sin, cos) * num_frequencies * num input_dim
#             self.out_dims += frequency_dims
# 
#         self.scales = tf.convert_to_tensor(
#             2.0 ** np.linspace(0.0, self.num_frequencies - 1, self.num_frequencies),
#             tf.float32,
#         )
# 
#     # @tf.function
#     def call(self, x):
#         assert (
#             x.shape[-1] == self.input_dims
#         ), "Channel dimension is %d but should be %d" % (x.shape[-1], self.input_dims)
# 
#         x_shape = tf.shape(x)
# 
#         xb = tf.reshape(
#             x[..., None, :] * self.scales[:, None],
#             tf.concat([x_shape[:-1], self.num_frequencies * x_shape[-1:]], 0),
#         )
# 
#         four_feat = tf.math.sin(tf.concat([xb, xb + 0.5 * np.pi], axis=-1))
# 
#         ret = []
#         if self.include_input:
#             ret += [x]
# 
#         return tf.concat(ret + [four_feat], axis=-1)
# 
#     def get_output_dimensionality(self):
#         return self.out_dims


# Path: models/brdf_ae_net/models.py
import tensorflow as tf
from tensorflow.python.keras.engine.input_layer import InputLayer
from nn_utils.nerf_layers import FourierEmbedding

        args,
        input_dimensions: int = 7,
        activation="relu",
        final_activation="linear",
        kernel_initializer="he_uniform",
        bias_initializer=tf.keras.initializers.Zeros,
        **kwargs,
    ):
        super(BrdfDiscriminator, self).__init__(**kwargs)

        net = [tf.keras.Input((input_dimensions,))]
        for _ in range(args.disc_d):
            net.append(
                tf.keras.layers.Dense(
                    args.disc_w,
                    activation=activation,
                    kernel_initializer=kernel_initializer,
                    bias_initializer=bias_initializer,
                )
            )

        net.append(
            tf.keras.layers.Dense(
                1,
                activation=final_activation,
                kernel_initializer=kernel_initializer,
                bias_initializer=bias_initializer,
            )
        )


        self.net = tf.keras.Sequential(net)