torch.save()
import torch from torch import nn from torch.nn import functional as F x= torch.arange(4) torch.save(x, "x-file") # 程序会自动将x写入到x-file文件中,若开始x-file文件未存在,系统会自动创建该文件名读文件
torch.load()
import torch
from torch import nn
from torch.nn import functional as F
x= torch.arange(4)
torch.save(x, "x-file")
print(x)
x2 = torch.load("x-file") #读取文件
print(x2)



