enchanter.addons¶
Activation functions¶
Mish¶
- class
enchanter.addons.Mish[source]¶ Bases:
torch.nn.modules.module.ModuleApply mish activate function.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Methods
forward(inputs)Apply Mish to the input.
Swish¶
- class
enchanter.addons.Swish(beta: bool = False)[source]¶ Bases:
torch.nn.modules.module.ModuleApply Swish activate function.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Methods
forward(x)Apply Swish function.
FReLU1d¶
- class
enchanter.addons.FReLU1d(in_features: int, kernel_size: int = 3, stride: int = 1, padding: int = 1)[source]¶ Bases:
torch.nn.modules.module.ModuleApplies the Funnel Activation (FReLU) for 1d inputs such as sensor signals.
Examples
>>> inputs = torch.randn(1, 3, 128) # [N, features, seq_len] >>> frelu = FReLU1d(3) >>> outputs = frelu(inputs)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Methods
forward(x)Applies the Funnel Activation (FReLU) for 1d inputs such as sensor signals.
FReLU2d¶
- class
enchanter.addons.FReLU2d(in_features: int, kernel_size: int = 3, stride: int = 1, padding: int = 1)[source]¶ Bases:
torch.nn.modules.module.ModuleApplies the Funnel Activation (FReLU) for 2d inputs such as images.
Examples
>>> inputs = torch.randn(1, 3, 128, 128) # [N, channels, heights, widths] >>> frelu = FReLU2d(3) >>> outputs = frelu(inputs)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Methods
forward(x)Applies the Funnel Activation (FReLU) for 2d inputs such as images.