pytorch 之torch.nn

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’)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值