(x, output_size, weight_decay, activation_fn=tf.nn.relu, params=None)
return x, params
Fully connected layer implementation.

  Args:
    x: tf.Tensor, input.
    output_size: int, number features in  the fully connected layer.
    weight_decay: float, scaling constant for L2 weight decay on weight
      variables.
    activation_fn: function, to process pre-activations, namely x*w+b.
    params: None or a dict containing the values of the weight and bias params.
      If None, default variables are used.

  Returns:
    output: The result of applying batch normalization to the input.
    params: dict, that includes parameters used during the calculation.
Fully connected layer implementation.
Fully connected layer implementation .
def dense(x, output_size, weight_decay, activation_fn=tf.nn.relu, params=None):
  """Fully connected layer implementation.

  Args:
    x: tf.Tensor, input.
    output_size: int, number features in  the fully connected layer.
    weight_decay: float, scaling constant for L2 weight decay on weight
      variables.
    activation_fn: function, to process pre-activations, namely x*w+b.
    params: None or a dict containing the values of the weight and bias params.
      If None, default variables are used.

  Returns:
    output: The result of applying batch normalization to the input.
    params: dict, that includes parameters used during the calculation.
  """
  with tf.variable_scope('dense'):
    scope_name = tf.get_variable_scope().name

    if len(x.shape) > 2:
      x = tf.layers.flatten(x),
    input_size = x.get_shape().as_list()[-1]

    w_name = scope_name + '/kernel'
    b_name = scope_name + '/bias'
    if params is None:
      w = weight_variable([input_size, output_size], weight_decay)
      b = bias_variable([output_size])
    else:
      w = params[w_name]
      b = params[b_name]

  x = tf.nn.xw_plus_b(x, w, b)
  params = collections.OrderedDict(zip([w_name, b_name], [w, b]))
  x = activation_fn(x)
  return x, params
def dense ( x , output_size , weight_decay , activation_fn = tf . nn . relu , params = None ) : with tf . variable_scope ( 'dense' ) : scope_name = tf . get_variable_scope ( ) . name if len ( x . shape ) > 2 : x = tf . layers . flatten ( x ) , input_size = x . get_shape ( ) . as_list ( ) [ - 1 ] w_name = scope_name + '/kernel' b_name = scope_name + '/bias' if params is None : w = weight_variable ( [ input_size , output_size ] , weight_decay ) b = bias_variable ( [ output_size ] ) else : w = params [ w_name ] b = params [ b_name ] x = tf . nn . xw_plus_b ( x , w , b ) params = collections . OrderedDict ( zip ( [ w_name , b_name ] , [ w , b ] ) ) x = activation_fn ( x ) return x , params