github上直接的代码
github上需要导入时写的代码块
import torch
import torchvision
import numpy as np
import sys
sys.path.append("..") # 为了导入上层目录的d2lzh_pytorch
import d2lzh_pytorch as d2l
自己写的代码块
import torch
import torchvision
import numpy as np
import sys
sys.path.append("F:\DeepLearning_Pytorch_2021_12\d2lzh_pytorch")
# 为了导入上层目录的d2lzh_pytorch
import d2lzh_pytorch as d2l
大家可能看到了,再sys.path.append位置把这个包的位置放上就可以了。注意d2lzh_pytorch文件夹下面就是__inti__,和__utils__ 这两个文件了。
链接与图片
(1)[d2lzh_pytorch]下载链接:https://pan.baidu.com/s/1vKr2FwEemGpyWwsVO81lKQ
提取码:6de2
).
(2)github学习资料:https://github.com/ShusenTang/Dive-into-DL-PyTorch/tree/master/docs
大家多学习多分享,解决一个小问题发的帖子都要开会员才能看,以后谁还用这个。