Linear

class ivy.neural_net_stateful.layers.Linear(input_channels, output_channels, weight_initializer=<ivy.neural_net_stateful.initializers.GlorotUniform object>, bias_initializer=<ivy.neural_net_stateful.initializers.Zeros object>, with_bias=True, dev_str=None, v=None)[source]

Bases: ivy.neural_net_stateful.module.Module

__init__(input_channels, output_channels, weight_initializer=<ivy.neural_net_stateful.initializers.GlorotUniform object>, bias_initializer=<ivy.neural_net_stateful.initializers.Zeros object>, with_bias=True, dev_str=None, v=None)[source]

Linear layer, also referred to as dense or fully connected. The layer receives tensors with input_channels last dimension and returns a new tensor with output_channels last dimension, following matrix multiplication with the weight matrix and addition with the bias vector.

Parameters
  • input_channels (int) – Number of input channels for the layer.

  • output_channels (int) – Number of output channels for the layer.

  • weight_initializer (ivy.Initializer, optional) – Initializer for the weights. Default is GlorotUniform.

  • bias_initializer (ivy.Initializer, optional) – Initializer for the bias. Default is Zeros.

  • with_bias (bool, optional) – Whether or not to include a bias term, default is True.

  • dev_str (str, optional) – device on which to create the layer’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. Default is cpu.

  • v (ivy container of variables, optional) – the variables for the linear layer, as a container, constructed internally by default.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty