【发布时间】:2020-11-19 21:22:13
【问题描述】:
我需要解释一下 PyTorch 中的 Conv2d 操作中发生了什么。
如果我运行以下命令:
import torch
import torch.nn.functional as F
torch.manual_seed(0)
x = torch.randint(20, (1,3,4,4));
y = torch.randint(2, (1,3,2,2));
z = F.conv2d(x,y, stride=1);
print(f"Input: (shape={x.shape})\n")
print(x)
print("")
print(f"Filter/convolutional kernel: (shape={y.shape})\n")
print(y)
print("")
print(f"Feature Map: (shape={z.shape})\n")
print(z)
我明白了:
特征图中左上角的条目不应该是:
19+19+6+16+8+18+17=103?
谢谢
【问题讨论】:
标签: python deep-learning pytorch