合集-torch

摘要:简单线性回归 y = 2*x + 1 import numpy as np import torch import torch.nn as nn class LinearRegressionModel(nn.Module): def __init__(self, input_dim, output_ 阅读全文
posted @ 2024-10-05 13:10 星空28 阅读(40) 评论(0) 推荐(0) 编辑
摘要:hub模块中有前人已经训练好的模型参数,可以根据情况调用 # hub模块:调用 # torch.hub.list('pytorch/vision:v0.10.0') # 使用前人已有的模型库 # https://github.com/pytorch/hub/blob/master/pytorch_v 阅读全文
posted @ 2024-10-05 14:49 星空28 阅读(28) 评论(0) 推荐(0) 编辑
摘要:utils.py import torch import matplotlib.pyplot as plt def plot_curve(data): fig = plt.figure() plt.plot(range(len(data)), data, color='blue') plt.lege 阅读全文
posted @ 2024-10-06 06:14 星空28 阅读(10) 评论(0) 推荐(0) 编辑
摘要:数据件文件temp.csv """ 气温预测 """ import datetime import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torch.optim as o 阅读全文
posted @ 2024-10-06 05:54 星空28 阅读(23) 评论(0) 推荐(0) 编辑
摘要:1、查看CUDA版本 -->打开cmd -->查看CUDA版本 nvidia-smi ![](https://img2024.cnblogs.com/blog/3437857/202412/3437857-20241217115657975-986317706.jpg) 2、找到CUDA版本对应的t 阅读全文
posted @ 2024-12-17 11:59 星空28 阅读(46) 评论(0) 推荐(0) 编辑
摘要:方式一:手动实现 """ drop out随机丢弃神经元 """ import torch from torch import nn from d2l import torch as d2l import torch import torchvision from torch.utils impor 阅读全文
posted @ 2024-11-07 11:44 星空28 阅读(9) 评论(0) 推荐(0) 编辑
摘要:""" 模型选择,欠拟合、过拟合 """ import math import numpy as np import torch from d2l import torch as d2l from IPython import display import matplotlib.pyplot as 阅读全文
posted @ 2024-11-06 13:53 星空28 阅读(6) 评论(0) 推荐(0) 编辑
摘要:方法一: """ 多层感知机简单实现Fashion-MNIST分类,从零开始实现 """ import torch import torchvision from torch.utils import data from torchvision import transforms from d2l 阅读全文
posted @ 2024-11-04 12:05 星空28 阅读(21) 评论(0) 推荐(0) 编辑
摘要:实现方式一:手动实现 # Fashion-MNIST分类 import torch import torchvision from torch.utils import data from torchvision import transforms from d2l import torch as 阅读全文
posted @ 2024-10-31 11:15 星空28 阅读(30) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示