CLASS torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True)
在由多个输入平面组成的输入信号上应用2D卷积
stride 控制互相关的步幅,单个数字或元组。
padding控制padding每个维度的点数的两侧隐式零填充量。
dilation控制内核点之间的间距; 也被称为àtrous算法。它更难描述,但这个链接 有很好的可视化dilation。
groups控制输入和输出之间的连接。 in_channels并且out_channels必须都可被整除 groups
torch.nn.Linear(in_features, out_features, bias=True)
Applies a linear transformation to the incoming data: y = xA^T + by=xA
T
+b
Parameters:
in_features – size of each input sample
out_features – size of each output sample
bias – If set to False, the layer will not learn an additive bias. Default: True
torch.device
A 是表示将要或将要分配a 的设备的对象。torch.devicetorch.Tensor
的包含一个设备类型(或)和任选的设备的序号 设备类型。如果设备序号不存在,则表示设备类型的当前设备 ; 例如,用设备构造的等价于X的结果 。torch.device’cpu’‘cuda’torch.Tensor’cuda’'cuda:X’torch.cuda.current_device()
甲的装置可以通过被访问属性。torch.TensorTensor.device
A 可以通过字符串或通过字符串和设备顺序构造torch.device
通过字符串:
torch.device(‘cuda:0’)
device(type=‘cuda’, index=0)
torch.device(‘cpu’)
device(type=‘cpu’)
torch.device(‘cuda’) # current cuda device
device(type=‘cuda’)