copapy.nn.linear#

copapy.nn.linear(x, weight, bias=None)#

Fully connected layer: weight @ x + bias

Parameters:
  • x (TVec) – Input of shape (in_features,) or (batch, in_features).

  • weight (array[Any] | ArrayType[Any] | Sequence[Any]) – Weights of shape (out_features, in_features).

  • bias (array[Any] | ArrayType[Any] | Sequence[Any] | None) – Optional bias of shape (out_features,).

Return type:

TVec

Returns:

Float array, tensor or vector (same type as x) of shape (out_features,) with a leading batch dimension if x has one.