Linear

class dragon.vm.torch.nn.Linear(
  in_features,
  out_features,
  bias=True
)[source]

Apply the linear transformation.

\[\text{out} = \text{input} \times \text{weight}^{T} + \text{bias} \]

Examples:

m = torch.nn.Linear(2, 3)
x = torch.ones(2, 2)
y = m(x)

__init__

Linear.__init__(
  in_features,
  out_features,
  bias=True
)[source]

Create a Linear module.

Parameters:
  • in_features (int) The number of input features.
  • out_features (int) The number of output features.
  • bias (bool, optional, default=True) Add a bias tensor to output or not.