text: #! /usr/bin/env python
  # coding=utf-8
  # Copyright (c) 2019 Uber Technologies, Inc.
  #
  # 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.
  # ==============================================================================
  import logging
  
  from tensorflow.keras.layers import Layer
  
  from ludwig.modules.fully_connected_modules import FCStack
  
  logger = logging.getLogger(__name__)
  
  
  class PassthroughEncoder(Layer):
  
      def __init__(
              self,
              **kwargs
      ):
          super(PassthroughEncoder, self).__init__()
          logger.debug(' {}'.format(self.name))
  
      def call(self, inputs, training=None, mask=None):
          """
              :param inputs: The inputs fed into the encoder.
                     Shape: [batch x 1], type tf.float32
          """
          return {'encoder_output': inputs}
  
  
  class DenseEncoder(Layer):
  
      def __init__(
              self,
              layers=None,
              num_layers=1,
              fc_size=256,
              use_bias=True,
              weights_initializer='glorot_uniform',
              bias_initializer='zeros',
              weights_regularizer=None,
              bias_regularizer=None,
              activity_regularizer=None,
              # weights_constraint=None,
              # bias_constraint=None,
              norm=None,
              norm_params=None,
              activation='relu',
              dropout=0,
              **kwargs
      ):
          super(DenseEncoder, self).__init__()
          logger.debug(' {}'.format(self.name))
  
          logger.debug('  FCStack')
          self.fc_stack = FCStack(
              layers=layers,
              num_layers=num_layers,
              default_fc_size=fc_size,
              default_use_bias=use_bias,
              default_weights_initializer=weights_initializer,
              default_bias_initializer=bias_initializer,
              default_weights_regularizer=weights_regularizer,
              default_bias_regularizer=bias_regularizer,
              default_activity_regularizer=activity_regularizer,
              # default_weights_constraint=weights_constraint,
              # default_bias_constraint=bias_constraint,
              default_norm=norm,
              default_norm_params=norm_params,
              default_activation=activation,
              default_dropout=dropout,
          )
  
      def call(self, inputs, training=None, mask=None):
          """
              :param inputs: The inputs fed into the encoder.
                     Shape: [batch x 1], type tf.float32
          """
          return {'encoder_output': self.fc_stack(inputs)}
  