多层感知器¶
- class torchvision.ops.MLP(in_channels: int, hidden_channels: ~typing.List[int], norm_layer: ~typing.Optional[~typing.Callable[[...], ~torch.nn.modules.module.Module]] = None, activation_layer: ~typing.Optional[~typing.Callable[[...], ~torch.nn.modules.module.Module]] = <class 'torch.nn.modules.activation.ReLU'>, inplace: ~typing.Optional[bool] = None, bias: bool = True, dropout: float = 0.0)[source]¶
该模块实现了多层感知器(MLP)模块。
- Parameters:
in_channels (int) – 输入的通道数
hidden_channels (List[int]) – 隐藏通道维度的列表
norm_layer (Callable[..., torch.nn.Module], optional) – 将堆叠在线性层之上的归一化层。如果
None,则不会使用此层。默认值:Noneactivation_layer (Callable[..., torch.nn.Module], optional) – 激活函数,将堆叠在归一化层之上(如果不是None),否则堆叠在线性层之上。如果
None则不会使用此层。默认值:torch.nn.ReLUinplace (bool, 可选) – 激活层的参数,可以选择性地进行原地操作。 默认是
None,这将使用activation_layer和 Dropout 层的各自默认值。偏差 (bool) – 是否在线性层中使用偏差。默认值为
Truedropout (float) – dropout层的概率。默认值:0.0