Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

💡 [REQUEST] - Neural Style Transfer: use AvgPool2d

オープン
#3,731 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@sekyondaMeta がすでに取り組んでいます。

2026年4月27日 から。

評価

この issue はまだ評価されていません。

説明

core
🚀 Describe the improvement or the new tutorial

Neural Style Transfer utilizes VGG network, which uses maximum pooling.

Although Original article suggests using average pooling instead for better results:

For image synthesis we found that replacing the maximum
pooling operation by average pooling yields slightly more
appealing results, which is why the images shown were generated with average pooling.

This is unsurprising, considering that max pooling may hide gradients of lower layers, while average pooling preserves them, so gradient descent for reconstructing image works better.

I confirm that it actually improves results.

Suggested changes

Replace that:

elif isinstance(layer, nn.MaxPool2d):
    name = 'pool_{}'.format(i)

with that:

elif isinstance(layer, nn.MaxPool2d):
    name = 'pool_{}'.format(i)
    layer = nn.AvgPool2d(
        kernel_size=layer.kernel_size, 
        stride=layer.stride, 
        padding=layer.padding, 
        ceil_mode=layer.ceil_mode)
Existing tutorials on this topic

https://docs.pytorch.org/tutorials/advanced/neural_style_tutorial.html

Additional context

No response

cc @albanD @jbschlosser

主要言語
Python
スター
9.4k
フォーク
4.4k
平均マージ
3日 5時間
マージ済み PR(30日)
4

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pytorch/tutorials のほかの issue

pytorch/tutorials の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。