gpt4 book ai didi

lua - 手电筒 nn : how to get the dimensions of the outputs (feature maps)?

转载 作者:行者123 更新时间:2023-12-04 21:26:10 29 4
gpt4 key购买 nike

在卷积模块中,许多参数可能会改变输入的维度。有什么方法可以获取卷积模块或任何模块的输出维度?

我尝试查看 SpatialConvolution 中公开的方法,但没有人建议给我该信息。

此外,输出张量似乎具有以下维度:

conv1 = nn.SpatialConvolution(3, 96, 5, 5, 1, 1, 2, 2)
conv1.id = 'conv1'
print(conv1.output:size())
[torch.LongStorage of size 0]

有什么想法吗?

我意识到我什至没有设置输入维度,除了 channel 数(即 3x32x32)。如何设置?为什么不是强制性的?

最佳答案

输出大小取决于您的输入大小。你可以尝试这样的事情:

th> require 'nngraph'
th> conv1 = nn.SpatialConvolution(3, 96, 5, 5, 1, 1, 2, 2)()
th> model = nn.gModule({conv1},{conv1})
th> x = torch.rand(3,20,20)
th> y = model:forward(x)
th> y:size()

96
20
20
[torch.LongStorage of size 3]

关于lua - 手电筒 nn : how to get the dimensions of the outputs (feature maps)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35676138/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com