pytorch学习笔记

来源:互联网 发布:nginx配置web目录 编辑:程序博客网 时间:2024/04/29 04:08

官方快速上手教程: http://pytorch.org/tutorials/beginner/blitz/tensor_tutorial.html


实战为王,建议工具: jupyter notebook


第一小节

What is PyTorch?

主要是numpy数据结构和torch tensor的转换,一点要注意的是“The torch Tensor and numpy array will share their underlying memory locations, and changing one will change the other.”



第二小节:

Autograd: automatic differentiation

主要讲基础求导的过程.
重要类型:
Variable, Function
有趣的大概就是这个backward函数了吧:

gradients = torch.FloatTensor([0.1, 1.0, 0.0001])
y.backward(gradients)
print(x.grad)   。。。。。。(j计算dy/dx)


第三小节,有点屌的神经网络来了:

Neural Networks

这小节的api需要好好琢磨一下,主要用的都是torch.nn包里面的api,