pytorch
液压姬
这个作者很懒,什么都没留下…
展开
-
pytorch-自我使用笔记
pytorchPyTorch由4个主要包组成:torch:类似于Numpy的通用数组库,可将张量类型转换torch.cuda.TensorFloat,并在GPU上进行计算。torch.autograd:用于构建计算图形并自动获取梯度的包。torch.nn:具有共享层和损失函数的神经网络库。torch.optim:具有通用优化算法(如SGD,Adam等)的优化包接口torch.func...原创 2020-12-08 21:23:14 · 758 阅读 · 0 评论 -
nn.AdaptiveAvgPool2d
官网nn.AdaptiveAvgPool2dnn.AdaptiveAvgPool2d就是自适应平均池化,指定输出(H,W)m = nn.AdaptiveAvgPool2d((5,1))input = torch.randn(1, 64, 8, 9)output = m(input)print(output.shape)torch.Size([1, 64, 5, 1])m = nn.AdaptiveAvgPool2d((None,1))input = torch.randn(1, 64,原创 2020-08-29 10:36:06 · 17990 阅读 · 0 评论 -
pytorch的模型保存和读取
pytorch的模型保存和读取torch.save: Saves a serialized object to disk. This function uses Python’s pickle utility for serialization. Models, tensors, and dictionaries of all kinds of objects can be saved using this function.torch.load: Uses pickle’s unpickling原创 2020-08-29 10:17:53 · 6669 阅读 · 1 评论