MLP¶
- 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)[原始碼]¶
此塊實現多層感知器(MLP)模組。
- 引數:
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, optional) – 啟用層的引數,可以選擇原地執行操作。預設值為
None,此時使用activation_layer和 Dropout 層各自的預設值。bias (bool) – 是否線上性層中使用偏置。預設值
Truedropout (float) – Dropout 層的機率。預設值:0.0