Linear

class ivy.neural_net_stateful.layers.Linear(input_channels, output_channels, dev_str='cpu', v=None)[source]

Bases: ivy.neural_net_stateful.module.Module

__init__(input_channels, output_channels, dev_str='cpu', 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.

  • 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 each of 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