linear_blocks
Linear block with optional normalization and activation.
Classes:
-
LinearBlock–Linear block consisting of a linear layer, normalization and activation.
LinearBlock
¶
LinearBlock(
in_channels: int,
out_channels: int,
act: Union[str, Callable, None] = None,
act_kwargs: Optional[Dict[str, Any]] = None,
act_first: bool = False,
bias: bool = True,
norm: Union[str, Callable, None] = None,
norm_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: Module
Linear block consisting of a linear layer, normalization and activation.
Parameters:
-
in_channels(int) –Number of input channels.
-
out_channels(int) –Number of output channels.
-
bias(bool, default:True) –Whether to use a bias for the linear layer.
-
act(Union[str, Callable, None], default:None) –Activation function to use. If
None, no activation is applied. -
act_kwargs(Optional[Dict[str, Any]], default:None) –Extra arguments for the activation function.
-
act_first(bool, default:False) –Whether to apply the activation function before the normalization.
-
norm(Union[str, Callable, None], default:None) –Normalization layer to use. If
None, no normalization is applied. -
norm_kwargs(Optional[Dict[str, Any]], default:None) –Extra arguments for the normalization layer.