Изменения

Перейти к: навигация, поиск

Инициализация параметров глубокой сети

282 байта убрано, 23:28, 11 мая 2022
новый пример для He
*<tex>w_i \sim \mathcal N(0,\frac{2}{n_{in}})</tex>
====Пример инициализации He на языке Pythonс библиотекой PyTorch====  <font color=darkgreen># example of the he weight initialization</font> from math import sqrt from numpy.random import randn <font color=darkgreen># number of nodes in the previous layer</font> n = 10 <font color=darkgreen># calculate the range for the weights</font> std = sqrt(2.0 / n) <font color=darkgreen># generate random numbers</font> numbers = randn(1000) <font color=darkgreen># scale to the desired range</font> scaled = numbers * std
<font color=darkgreen># инициализация параметров одного слоя</font>
conv1 = torch.nn.Conv2d(...)
torch.nn.init.kaiming_uniform_(w)
==См.также==
50
правок

Навигация