当前位置:网站首页>nn. PReLU(planes)
nn. PReLU(planes)
2022-06-12 20:58:00 【Human high quality Algorithm Engineer】
PReLU Activation function , Internal source code implementation
def __init__(self, num_parameters: int = 1, init: float = 0.25) -> None:
self.num_parameters = num_parameters
super(PReLU, self).__init__()
self.weight = Parameter(torch.Tensor(num_parameters).fill_(init))
def forward(self, input: Tensor) -> Tensor:
return F.prelu(input, self.weight)
def prelu(input, weight):
# type: (Tensor, Tensor) -> Tensor
r"""prelu(input, weight) -> Tensor Applies element-wise the function :math:`\text{PReLU}(x) = \max(0,x) + \text{weight} * \min(0,x)` where weight is a learnable parameter. See :class:`~torch.nn.PReLU` for more details. """
if not torch.jit.is_scripting():
if type(input) is not Tensor and has_torch_function((input,)):
return handle_torch_function(prelu, (input,), input, weight)
return torch.prelu(input, weight)
The above formula leads to typora Li is in the following form :
weight Here is a learnable parameter , When called nn.PReLU(planes) Only the number of channels is entered , Implement Li Jiang weight Parameters are initialized to 0.25.
This is similar to what we know PRelu The formula is the same ,
边栏推荐
- Introduction to scala basic grammar (III) various operators in Scala
- Simplest ALV template
- How to download putty using alicloud image?
- Research Report on hydraulic solenoid valve industry - market status analysis and development prospect forecast
- Zhangqiming, vice director of the United Front Work Department of the CPC Anhui Provincial Committee, led a team to investigate the HoloNet Royal Hefei R & D base
- Listener in JSP
- How to implement overloading in JS
- leetcode:210. 课程表 II
- String Basics
- Integrated monitoring solution for power environment of small and medium-sized computer rooms
猜你喜欢
没有学历,自学软件测试,找到一份月入过万的测试工作真的有可能吗?
Data visualization - Calendar chart
String Basics
[leetcode 16 solution] the sum of the nearest three numbers
同时做测试,别人已经年薪20w起,为什么你还在为达到月薪10k而努力?
EditText control starts from the upper left corner
shell语言
leetcode:207. Class Schedule Card
Fcpx tutorial, how to export video graphics and text in Final Cut Pro?
Lombok package is successfully installed, but the runtime prompts that get, set method and constructor solution cannot be found
随机推荐
Inrelease: the following signature cannot be verified because there is no public key: no_ PUBKEY EB3E94ADBE1229CF
UVa11991 Easy Problem from Rujia Liu
初步了解認識正則錶達式(Regex)
Detect current system language
Lombok package is successfully installed, but the runtime prompts that get, set method and constructor solution cannot be found
new做了哪几件事
Properties to YML
Algorinote_2_主定理与 Akra-Bazzi 定理
Introduction to scala basic grammar (III) various operators in Scala
typeScript的定义类型:不能将类型“Timeout”分配给类型“number”;
Event distribution mechanism of view
How can the openwrt package manager image be switched to an alicloud source?
(11) Image frequency domain filtering with OpenCV
Cv2.lut() (populates the output array with values from the lookup table)
Proxy and reflection
对闭包的理解
Solution of multi machine room dynamic loop status network touch screen monitoring
At the same time, do the test. Others have been paid 20W a year. Why are you still working hard to reach 10K a month?
remote: Support for password authentication was removed on August 13, 2021
Allegro Xile technology, a developer of distributed cloud services, received millions of dollars of angel round financing and was independently invested by Yaotu capital