0
点赞
收藏
分享

微信扫一扫

pytorch 神经网络存取

蛇发女妖 2022-01-23 阅读 98
import torch
from torch import nn

#trap
class Tudui(nn.Module):
    def __init__(self):
        super(Tudui, self).__init__()
        self.conv1 = nn.Conv2d(3, 64, kernel_size=3)

    def forward(self, x):
        x = self.conv1(x)
        return x


tudui = Tudui()
torch.save(tudui, 'tudui_method.pth')
'''
after training
'''
model = torch.load('tudui_method.pth')
print(model)
举报

相关推荐

0 条评论