(x, names, shapes, has_bias=True)
Linear Layer.
Linear Layer.
Linear Layer .
def linear(x, names, shapes, has_bias=True):
  """Linear Layer."""
  assert len(shapes) == 2
  with tf.variable_scope(names):
    weights = tf.get_variable(
        name='weights',
        shape=shapes,
        initializer=tf.initializers.glorot_uniform())
    if has_bias:
      bias = tf.get_variable(
          name='bias',
          shape=shapes[1],
          initializer=tf.initializers.glorot_uniform())
      return tf.matmul(x, weights) + bias
    else:
      return tf.matmul(x, weights)
def linear ( x , names , shapes , has_bias = True ) : assert len ( shapes ) == 2 with tf . variable_scope ( names ) : weights = tf . get_variable ( name = 'weights' , shape = shapes , initializer = tf . initializers . glorot_uniform ( ) ) if has_bias : bias = tf . get_variable ( name = 'bias' , shape = shapes [ 1 ] , initializer = tf . initializers . glorot_uniform ( ) ) return tf . matmul ( x , weights ) + bias else : return tf . matmul ( x , weights )