上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: import torch import torch.nn.functional as F import matplotlib.pyplot as plt import numpy as np x = torch.linspace(-10,10,60) fig = plt.figure(figsize 阅读全文
posted @ 2020-06-30 10:09 九叶草 阅读(1017) 评论(0) 推荐(0)
摘要: 我们可以看到绘制出来的图有四个边框,我们通过gca()对坐标轴进行一些简单处理,代码如下。 import torch import torch.nn.functional as F import matplotlib.pyplot as plt import numpy as np x = torc 阅读全文
posted @ 2020-06-30 09:39 九叶草 阅读(6974) 评论(0) 推荐(0)
摘要: 本篇是摘抄pytorch-handbook里面的,有兴趣可以看看。 损失函数(Loss Function) 损失函数(loss function)是用来估量模型的预测值(我们例子中的output)与真实值(例子中的y_train)的不一致程度,它是一个非负实值函数,损失函数越小,模型的鲁棒性就越好。 阅读全文
posted @ 2020-06-29 17:30 九叶草 阅读(7340) 评论(0) 推荐(0)
摘要: import torch x = torch.rand(2,2) x1 = x.numpy() # torch转换到numpy x2 = torch.from_numpy(x1) #numpy转换torch print("\n torch_x:\n",x, "\n numpy_x1:\n",x1, 阅读全文
posted @ 2020-06-29 16:40 九叶草 阅读(9416) 评论(0) 推荐(0)
摘要: 官方文档 首先我们要知道,lmplot是用来绘制回归图的。 让我们来看看他的API: seaborn.lmplot(x, y, data, hue=None, col=None, row=None, palette=None, col_wrap=None, height=5, aspect=1, m 阅读全文
posted @ 2020-06-29 11:40 九叶草 阅读(13080) 评论(0) 推荐(3)
摘要: 看了一篇博客,感觉写的很棒:PyTorch 的 Autograd 阅读全文
posted @ 2020-06-28 17:52 九叶草 阅读(164) 评论(0) 推荐(0)
摘要: 运行这段代码 import torch import numpy as np import matplotlib.pyplot as plt x = torch.ones(2,2,requires_grad=True) print('x:\n',x) y = torch.eye(2,2,requir 阅读全文
posted @ 2020-06-28 09:02 九叶草 阅读(23504) 评论(0) 推荐(0)
摘要: output = torch.max(input, dim) input输入的是一个tensor dim是max函数索引的维度0/1,0是每列的最大值,1是每行的最大值 实例: import torch import numpy as np import matplotlib.pyplot as p 阅读全文
posted @ 2020-06-27 19:49 九叶草 阅读(5096) 评论(0) 推荐(0)
摘要: 本篇借鉴了这篇文章,如果有兴趣,大家可以看看:https://blog.csdn.net/geter_CS/article/details/84857220 1、交叉熵:交叉熵主要是用来判定实际的输出与期望的输出的接近程度 2、CrossEntropyLoss()损失函数结合了nn.LogSoftm 阅读全文
posted @ 2020-06-26 13:47 九叶草 阅读(17860) 评论(0) 推荐(0)
摘要: 看pytorch中文文档摘抄的笔记。 class torch.optim.SGD(params, lr=, momentum=0, dampening=0, weight_decay=0, nesterov=False)[source] 实现随机梯度下降算法(momentum可选)。 Nestero 阅读全文
posted @ 2020-06-26 11:53 九叶草 阅读(43035) 评论(0) 推荐(3)
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页