06 2023 档案

摘要:首先要感谢CSDN中http://t.csdn.cn/XyT4e这篇文章(我接下来写的内容,也和这篇文章基本一样) 下面是我实际操作得到的结果: 我们看第一种情况的代码: import torch b = torch.arange(1, 61).reshape(3, 4, 5) idx1 = tor 阅读全文
posted @ 2023-06-14 00:29 啥都不会的灰太狼 阅读(76) 评论(0) 推荐(0) 编辑
摘要:在这里先把代码放上来 import torch import time import numpy as np import torchvision from torch.utils import data from torchvision import transforms from d2l imp 阅读全文
posted @ 2023-06-12 23:04 啥都不会的灰太狼 阅读(31) 评论(0) 推荐(0) 编辑
摘要:从零开始实现的代码如下: import math import random #随机梯度下降 随机的权重 import time import numpy as np from d2l import torch as d2l #实现过的函数写在d2l包中 ''' 加这两句是为了能画出散点图,不然会报 阅读全文
posted @ 2023-06-11 12:05 啥都不会的灰太狼 阅读(37) 评论(0) 推荐(0) 编辑
摘要:#我们在这里画的是方程3*x**2 - 4*x 在x = 1处的切线#欠拟合:欠拟合指的是模型对训练数据的拟合度过低,误差值过大,自然泛化能力也不怎么好。 #泛化能力指模型对未知数据的拟合度 #过拟合:指模型对训练数据的拟合度较好,误差值较小,但是泛化能力并不好。 #对误差函数进行惩罚,从而提高模型 阅读全文
posted @ 2023-06-08 21:34 啥都不会的灰太狼 阅读(93) 评论(0) 推荐(0) 编辑
摘要:import torch #标量由只有一个元素的张量表示 ''' x = torch.tensor(3.0) y = torch.tensor(2.0) print(x + y) print(x * y) print(x / y) print(x ** y) ''' ''' 向量可以被视为标量值组成 阅读全文
posted @ 2023-06-03 17:21 啥都不会的灰太狼 阅读(16) 评论(0) 推荐(0) 编辑