# Path: tf_slim/layers/utils.py
# def collect_named_outputs(collections, alias, outputs):
# def append_tensor_alias(tensor, alias):
# def gather_tensors_aliases(tensors):
# def get_tensor_aliases(tensor):
# def convert_collection_to_dict(collection, clear_collection=False):
# def constant_value(value_or_tensor_or_var, dtype=None):
# def static_cond(pred, fn1, fn2):
# def smart_cond(pred, fn1, fn2, name=None):
# def get_variable_collections(variables_collections, name):
# def _get_dimension(shape, dim, min_rank=1):
# def channel_dimension(shape, data_format, min_rank=1):
# def last_dimension(shape, min_rank=1):
# def two_element_tuple(int_or_tuple):
# def n_positive_integers(n, value):
# 
# Path: tf_slim/ops/variables.py
# def assert_global_step(global_step_tensor):
# def assert_or_get_global_step(graph=None, global_step_tensor=None):
# def get_global_step(graph=None):
# def create_global_step(graph=None):
# def get_or_create_global_step(graph=None):
# def local_variable(initial_value,
#                    validate_shape=True,
#                    name=None,
#                    use_resource=None):
# def global_variable(initial_value,
#                     validate_shape=True,
#                     name=None,
#                     use_resource=None):
# def variable(name,
#              shape=None,
#              dtype=None,
#              initializer=None,
#              regularizer=None,
#              trainable=True,
#              collections=None,
#              caching_device=None,
#              device=None,
#              partitioner=None,
#              custom_getter=None,
#              use_resource=None,
#              synchronization=variables.VariableSynchronization.AUTO,
#              aggregation=variables.VariableAggregation.NONE):
# def model_variable(name,
#                    shape=None,
#                    dtype=dtypes.float32,
#                    initializer=None,
#                    regularizer=None,
#                    trainable=True,
#                    collections=None,
#                    caching_device=None,
#                    device=None,
#                    partitioner=None,
#                    custom_getter=None,
#                    use_resource=None,
#                    synchronization=variables.VariableSynchronization.AUTO,
#                    aggregation=variables.VariableAggregation.NONE):
# def add_model_variable(var):
# def get_variables(scope=None,
#                   suffix=None,
#                   collection=ops.GraphKeys.GLOBAL_VARIABLES):
# def get_model_variables(scope=None, suffix=None):
# def get_local_variables(scope=None, suffix=None):
# def get_trainable_variables(scope=None, suffix=None):
# def get_variables_to_restore(include=None, exclude=None):
# def get_variables_by_suffix(suffix, scope=None):
# def get_variables_by_name(given_name, scope=None):
# def get_unique_variable(var_op_name):
# def assign_from_values(var_names_to_values):
# def assign_from_values_fn(var_names_to_values):
#   def callback(session):
# def get_variable_full_name(var):
# def assign_from_checkpoint(model_path, var_list, ignore_missing_vars=False):
# def assign_from_checkpoint_fn(model_path,
#                               var_list,
#                               ignore_missing_vars=False,
#                               reshape_variables=False):
#     def callback(session):
#   def __init__(self,
#                num_tasks=0,
#                job_name='ps',
#                device_type='CPU',
#                device_index=0,
#                replica=None):
#   def __call__(self, op):
# def filter_variables(var_list,
#                      include_patterns=None,
#                      exclude_patterns=None,
#                      reg_search=True):
# class VariableDeviceChooser(object):
# 
# Path: tf_slim/ops/arg_scope.py
# def add_arg_scope(func):
#   """Decorates a function with args so it can be used within an arg_scope.
# 
#   Args:
#     func: function to decorate.
# 
#   Returns:
#     A tuple with the decorated function func_with_args().
#   """
# 
#   def func_with_args(*args, **kwargs):
#     current_scope = current_arg_scope()
#     current_args = kwargs
#     key_func = arg_scope_func_key(func)
#     if key_func in current_scope:
#       current_args = current_scope[key_func].copy()
#       current_args.update(kwargs)
#     return func(*args, **current_args)
# 
#   _add_op(func)
#   setattr(func_with_args, '_key_op', arg_scope_func_key(func))
#   return tf_decorator.make_decorator(func, func_with_args)


import tensorflow.compat.v1 as tf
from tf_slim.layers import utils
from tf_slim.ops import variables
from tf_slim.ops.arg_scope import add_arg_scope
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn
from tensorflow.python.ops import variable_scope
#
# 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.
# =============================================================================
"""Contains the normalization layer classes and their functional aliases."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=g-direct-tensorflow-import


__all__ = [
    'group_norm',
    'instance_norm',
]

DATA_FORMAT_NCHW = 'NCHW'
DATA_FORMAT_NHWC = 'NHWC'



# Path: tf_slim/layers/utils.py
# def collect_named_outputs(collections, alias, outputs):
# def append_tensor_alias(tensor, alias):
# def gather_tensors_aliases(tensors):
# def get_tensor_aliases(tensor):
# def convert_collection_to_dict(collection, clear_collection=False):
# def constant_value(value_or_tensor_or_var, dtype=None):
# def static_cond(pred, fn1, fn2):
# def smart_cond(pred, fn1, fn2, name=None):
# def get_variable_collections(variables_collections, name):
# def _get_dimension(shape, dim, min_rank=1):
# def channel_dimension(shape, data_format, min_rank=1):
# def last_dimension(shape, min_rank=1):
# def two_element_tuple(int_or_tuple):
# def n_positive_integers(n, value):
# 
# Path: tf_slim/ops/variables.py
# def assert_global_step(global_step_tensor):
# def assert_or_get_global_step(graph=None, global_step_tensor=None):
# def get_global_step(graph=None):
# def create_global_step(graph=None):
# def get_or_create_global_step(graph=None):
# def local_variable(initial_value,
#                    validate_shape=True,
#                    name=None,
#                    use_resource=None):
# def global_variable(initial_value,
#                     validate_shape=True,
#                     name=None,
#                     use_resource=None):
# def variable(name,
#              shape=None,
#              dtype=None,
#              initializer=None,
#              regularizer=None,
#              trainable=True,
#              collections=None,
#              caching_device=None,
#              device=None,
#              partitioner=None,
#              custom_getter=None,
#              use_resource=None,
#              synchronization=variables.VariableSynchronization.AUTO,
#              aggregation=variables.VariableAggregation.NONE):
# def model_variable(name,
#                    shape=None,
#                    dtype=dtypes.float32,
#                    initializer=None,
#                    regularizer=None,
#                    trainable=True,
#                    collections=None,
#                    caching_device=None,
#                    device=None,
#                    partitioner=None,
#                    custom_getter=None,
#                    use_resource=None,
#                    synchronization=variables.VariableSynchronization.AUTO,
#                    aggregation=variables.VariableAggregation.NONE):
# def add_model_variable(var):
# def get_variables(scope=None,
#                   suffix=None,
#                   collection=ops.GraphKeys.GLOBAL_VARIABLES):
# def get_model_variables(scope=None, suffix=None):
# def get_local_variables(scope=None, suffix=None):
# def get_trainable_variables(scope=None, suffix=None):
# def get_variables_to_restore(include=None, exclude=None):
# def get_variables_by_suffix(suffix, scope=None):
# def get_variables_by_name(given_name, scope=None):
# def get_unique_variable(var_op_name):
# def assign_from_values(var_names_to_values):
# def assign_from_values_fn(var_names_to_values):
#   def callback(session):
# def get_variable_full_name(var):
# def assign_from_checkpoint(model_path, var_list, ignore_missing_vars=False):
# def assign_from_checkpoint_fn(model_path,
#                               var_list,
#                               ignore_missing_vars=False,
#                               reshape_variables=False):
#     def callback(session):
#   def __init__(self,
#                num_tasks=0,
#                job_name='ps',
#                device_type='CPU',
#                device_index=0,
#                replica=None):
#   def __call__(self, op):
# def filter_variables(var_list,
#                      include_patterns=None,
#                      exclude_patterns=None,
#                      reg_search=True):
# class VariableDeviceChooser(object):
# 
# Path: tf_slim/ops/arg_scope.py
# def add_arg_scope(func):
#   """Decorates a function with args so it can be used within an arg_scope.
# 
#   Args:
#     func: function to decorate.
# 
#   Returns:
#     A tuple with the decorated function func_with_args().
#   """
# 
#   def func_with_args(*args, **kwargs):
#     current_scope = current_arg_scope()
#     current_args = kwargs
#     key_func = arg_scope_func_key(func)
#     if key_func in current_scope:
#       current_args = current_scope[key_func].copy()
#       current_args.update(kwargs)
#     return func(*args, **current_args)
# 
#   _add_op(func)
#   setattr(func_with_args, '_key_op', arg_scope_func_key(func))
#   return tf_decorator.make_decorator(func, func_with_args)


# Path: tf_slim/layers/normalization.py
import tensorflow.compat.v1 as tf
from tf_slim.layers import utils
from tf_slim.ops import variables
from tf_slim.ops.arg_scope import add_arg_scope
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn
from tensorflow.python.ops import variable_scope

#
# 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.
# =============================================================================
"""Contains the normalization layer classes and their functional aliases."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=g-direct-tensorflow-import


__all__ = [
    'group_norm',
    'instance_norm',
]

DATA_FORMAT_NCHW = 'NCHW'
DATA_FORMAT_NHWC = 'NHWC'



@add_arg_scope