模组¶
这里用于提供类似Pytorch原生的一些模块,之后使用Modules进行包装调用。
-
class
Swish
[源代码]¶ 基类:
torch.nn.modules.module.Module
Swish activation function:
\[\text{Swish}(x) = x * Sigmoid(x)\]- Shape:
Input: \((N, *)\) where * means, any number of additional dimensions
Output: \((N, *)\), same shape as the input
-
forward
(input)[源代码]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
注解
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class
HSwish
[源代码]¶ 基类:
torch.nn.modules.module.Module
Hard Swish activation function:
\[\text{Swish}(x) = x * \frac{ReLU6(x+3)}{6}\]- Shape:
Input: \((N, *)\) where * means, any number of additional dimensions
Output: \((N, *)\), same shape as the input
-
forward
(input)[源代码]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
注解
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class
Mish
[源代码]¶ 基类:
torch.nn.modules.module.Module
Mish activation function:
\[\text{Mish}(x) = x * tanh(\ln(1 + e^x))\]- Shape:
Input: \((N, *)\) where * means, any number of additional dimensions
Output: \((N, *)\), same shape as the input
-
forward
(input)[源代码]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
注解
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
class
Bilinear
(in1_features, in2_features, out_features, expand=False, bias_x=True, bias_y=True)[源代码]¶ 基类:
torch.nn.modules.module.Module
-
forward
(x1, x2)[源代码]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
注解
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
Biaffine
(in1_features, in2_features, out_features, bias_x=True, bias_y=True, **kwargs)[源代码]¶ 基类:
torch.nn.modules.module.Module
-
forward
(x1, x2)[源代码]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
注解
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-