python - PyTorch 2D 卷积层需要解释
问题描述
我需要解释 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
?
谢谢
解决方案
原来我的算术是错误的!
19+19+6+16+8+3+19=90
!
推荐阅读
- camera - 如何使用外部 USB 摄像头在 uv4l 上设置帧速率
- text - 如何在 Neo4j 中将选择性查询结果连接为字符串?
- java - Java中的凯撒密码频率分析
- javascript - 使用 Places Autocomplete 在输入中输出城镇/城市而不是完整位置
- git - 错误:尝试重写历史时,pack-objects 死于信号 9517
- angular - 角度输入“必需”总是错误的
- html - 提交后如何保留选定的选项?
- excel - 创建宏以使用某些单元格中预定义的信息来命名 Excel 文件
- javascript - 在 Vue.js 的 v-for 循环中更改此按钮的属性
- eclipse-che - 如何使用我自己的更改构建 Che Theia 图像?