摘要:
5.5.1 加载和保存 import torch from torch import nn from torch.nn import functional as F x = torch.arange(4) torch.save(x, 'x-file') # 使用 save 保存 x2 = torch 阅读全文
摘要:
5.4.1 不带参数的层 import torch import torch.nn.functional as F from torch import nn class CenteredLayer(nn.Module): def __init__(self): super().__init__() 阅读全文
摘要:
import torch from torch import nn from d2l import torch as d2l 下面实例化的多层感知机的输入维度是未知的,因此框架尚未初始化任何参数,显示为“UninitializedParameter”。 net = nn.Sequential(nn. 阅读全文