Pytorch使用cnn处理多变量时间序列预测框架//未完待续

咱们用1d-cnn来做这个时间序列的特征提取

有些小问题pytorch不像keras的卷积有padding='same'这种操作,

如果我输入是(Batch_size,channel,sequence_length)这种shape的数据,

我想输出后得到一样的shape怎么做呢?

from torch import nn
import torch
conv1 = nn.Conv1d(in_channels=7,out_channels=7,kernel_size=5,stride=1,padding=2)
input = torch.randn(32,7,96)
# batch_size x text_len x embedding_size -> batch_size x embedding_size x text_len
# input = input.permute(0,2,1)
out = conv1(input)
print(out.size())

那么padding=0,1,2,3分别是什么意思呢?

PyTorch中的padding操作_AI算法-图哥的博客-CSDN博客_padding pytorch

 问问欢哥

#这个思考很重要 

如何分析pytorch的一维卷积nn.Conv1d - 大数据 - 亿速云

猜你喜欢

转载自blog.csdn.net/weixin_43332715/article/details/127738837