Изменения

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

Neural Style Transfer

81 байт добавлено, 23:01, 18 апреля 2019
Пример кода на Python
'''Функция потери стиля'''
'''def''' gram_matrix(input):
a, b, c, d = input.size() <font color="green"># a=batch size(=1)</font>
<font color="green"># b=number of feature maps</font>
<font color="green"># (c,d)=dimensions of a f. map (N=c*d)</font>
features = input.view(a * b, c * d) <font color="green"># resise F_XL into \hat F_XL</font> G = torch.mm(features, features.t()) <font color="green"># compute the gram product</font>
<font color="green"># we 'normalize' the values of the gram matrix</font>
<font color="green"># by dividing by the number of element in each feature maps.</font>
Анонимный участник

Навигация