![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
mznfirst
科技改变生活,代码创造未来!
展开
-
使用Python Matplotlib库绘制直方图、曲线图和折线图
将数据保存在excel表格中,用xlrd读取xlsx表格文件中的数据,将之绘图。首先安装依赖库Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4.Beginning with Matplotlib 3.0, Python 3.5 and above is required.pip3 install ...原创 2019-06-13 17:04:45 · 215 阅读 · 0 评论 -
Python笔记1
1. 转换Python list类型为numpy数组先定义一个list列表,然后用np.ndarray来转换k = [[0,2,1],[0,1,0],[0,0,1]]ret = np.asarray(k)2. 变量相乘和矩阵相乘#-*- coding:utf-8 -*-import numpy as npa = np.array([[1,1], [0,1...原创 2019-01-04 16:50:01 · 103 阅读 · 1 评论 -
Pytorch 笔记 -- model模型
1. 保存载入模型import torchtorch.save(model,'model_name') #将网络模型、模型参数全部保存torc.save(model.state_dict(),'model_name.pkl') #只保存模型参数两种载入方式也不相同torch.load('model_name')from torchvision import modelsmod...原创 2019-01-04 17:17:36 · 875 阅读 · 0 评论 -
Pytorch 对nn.Parameter类型变量赋值bug
在使用Pytorch赋值过程中有一些小细节需要注意。先出示实验结果初始化一个值为1的tensortorch.Tensor([1])正确的赋值方式: w.data[0]=a实验记录In [1]: import torch# 初始化参数 w,a ,b,In [2]: w = torch.nn.Parameter(torch.zeros(4))In [3]: wOut[3]:...原创 2019-03-28 14:58:10 · 5207 阅读 · 1 评论