【发布时间】:2021-07-10 14:14:24
【问题描述】:
我想找出卷积运算的 output_size,但我正在努力将我的数据帧转换为张量。
output_size = torch.nn.Conv2d(3, 5, 5,stride=1, padding=3,
dilation=1, groups=1, bias=True, padding_mode='zeros')
fashion = torch.from_numpy(load_fashion)
input_ = torch.Tensor((fashion.values), dtype=torch.float)
output = output_size(input_)
【问题讨论】:
-
假设
load_fashion是您的数据框,fashion = torch.from_numpy(load_fashion.values, dtype=torch.float)应该就足够了。请注意,在传递给 Conv2d 之前,您还需要将张量重塑为 (batch_size, channel, H, W) 形状。