# coding=utf-8
# Copyright 2020 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.

"""Declaration of a few external GIN configurable functions."""

from gin import config

# pylint: disable=unused-import
from gin.tf import external_configurables
# pylint: enable=unused-import

import tensorflow as tf

# Activation function.
config.external_configurable(tf.keras.activations.relu,
                             'tf.keras.activations.relu')

# Layers
config.external_configurable(tf.keras.layers.Add, 'tf.keras.layers.Add')
config.external_configurable(tf.keras.layers.Concatenate,
                             'tf.keras.layers.Concatenate')

# Loss functions
config.external_configurable(tf.keras.losses.MeanSquaredError,
                             'tf.keras.losses.MeanSquaredError')

config.external_configurable(tf.keras.losses.CategoricalCrossentropy,
                             'tf.keras.losses.CategoricalCrossentropy')

# coding=utf-8
# Copyright 2020 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.

"""Declaration of a few external GIN configurable functions."""

from gin import config

# pylint: disable=unused-import
from gin.tf import external_configurables
# pylint: enable=unused-import

import tensorflow as tf

# Activation function.
config.external_configurable(tf.keras.activations.relu,
                             'tf.keras.activations.relu')
config.external_configurable(tf.nn.relu6, 'tf.nn.relu6')

# Layers
config.external_configurable(tf.keras.layers.Add, 'tf.keras.layers.Add')
config.external_configurable(tf.keras.layers.Concatenate,
                             'tf.keras.layers.Concatenate')

# Loss functions
config.external_configurable(tf.keras.losses.MeanSquaredError,
                             'tf.keras.losses.MeanSquaredError')

config.external_configurable(tf.keras.losses.CategoricalCrossentropy,
                             'tf.keras.losses.CategoricalCrossentropy')

add tf.nn.relu6 to gin_external_configurables