Skip to content

Linear

source

Linear(input_layer: Layer, n_units, shape=None add_bias=True)

Fully connected layer that implements a linear transformation of the form f(x) = Wx + b

Args

  • input_layer (Layer) : input layer or a value convertible to Layer
  • n_units (int) : output dim
  • weights_shape : weights shape, needed if n_units and input_layer.n_units is not known.
  • weight_init (Callable) : weights (W) initializer function
  • bias_init (Callable) : bias initializer function
  • weights (tf.Variable) : variable to be used as linear weights
  • bias (tf.Variable) : variable to be used as a bias
  • add_bias (`bool) : if True, this layers becomes an affine transformation layer xW+b
  • transpose_weights (bool) : if True, transposes the weights
  • sparse_weights (bool) : if True indicates we are using a sparse tensor instead of a tf.Variable for weights
  • weight_norm (bool) : if True weights are normalised
  • dtype (tf.DType) : type for layer variables
  • name (str) : layer name
  • share_state_with (Linear or None) : Linear layer with which we wish to share the state

Methods:

.compute_shape

source

.compute_shape()

.init_state

source

.init_state()

.compute

source

.compute(
   input_tensor
)

.reuse_with

source

.reuse_with(
   input_layer, name = None, transpose_weights = None, sparse_weights = None,
   shape = None
)

Reuses the current layer on a different input.