PyTorch安装和快速上手
基础安装和工具使用
- 安装Anaconda3,内置python3.7
- 启动Jupyter Notebook
命令终端输入:jupyter notebook
命令运行后,浏览器输入:http://loaclhost:8888
Numpy基础知识
- numpy:对数组的快速操作
- numpy包核心对象是ndarrary,封装了相同数据类型的n维数组
- numpy中维度叫做轴,轴的个数叫做秩
- ndarrary属性
- ndim:数组轴的个数
- shape:数组的维度
- size:数组元素的总个数
- dtype:数据元素类型
- 创建数组相关
>>> import numpy as np
>>> a = np.array([2,3,4])
>>> a
array([2, 3, 4])
>>> a.dtype
dtype('int32')
>>> b = np.array([(1.5,2,3),(4,5,6)])
>>> b
array([[1.5, 2. , 3. ],
[4. , 5. , 6. ]])
>>> np.zeros((3,4))
array([[0., 0., 0., 0.],
[0., 0., 0., 0.],
[0., 0., 0., 0.]])