如何在jupyter notebook中浏览特定Python包的源代码?

2026-05-21 20:070阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计171个文字,预计阅读时间需要1分钟。

如何在jupyter notebook中浏览特定Python包的源代码?

最近在学习李沐的动手深度学习,做实验时常用封装好的d2l包。但我想写出接近原生的代码,所以想查看一下d2l包是如何编写的,具体步骤如下:+ 打开jupyter+ from d2l import torch as torch


最近在学习李沐的动手深度学习,在做实验时,他经常用封装好的d2l包,但是我想写出接近原生的代码,所以想查看一下d2l是怎么写的,具体步骤如下:

打开jupyter

from d2l import torch as d2l
with open(d2l.__file__,'r') as f:
print(f.read())

结果:

如何在jupyter notebook中浏览特定Python包的源代码?


本文共计171个文字,预计阅读时间需要1分钟。

如何在jupyter notebook中浏览特定Python包的源代码?

最近在学习李沐的动手深度学习,做实验时常用封装好的d2l包。但我想写出接近原生的代码,所以想查看一下d2l包是如何编写的,具体步骤如下:+ 打开jupyter+ from d2l import torch as torch


最近在学习李沐的动手深度学习,在做实验时,他经常用封装好的d2l包,但是我想写出接近原生的代码,所以想查看一下d2l是怎么写的,具体步骤如下:

打开jupyter

from d2l import torch as d2l
with open(d2l.__file__,'r') as f:
print(f.read())

结果:

如何在jupyter notebook中浏览特定Python包的源代码?