当前位置: 首页 > news >正文

怎么在网站空间上传文件热搜榜排名前十

怎么在网站空间上传文件,热搜榜排名前十,辽宁建设工程信息网联合体投标,做网站怎么一、DataLoader简介 DataLoader官网 重要参数:画红框的参数 dataset: 作用:表示要加载的数据集。DataLoader通过该参数从数据集中读取数据。类型:Dataset,即PyTorch定义的Dataset类,用于封装数据并提供数据索引的功…

在这里插入图片描述

一、DataLoader简介

DataLoader官网
在这里插入图片描述
重要参数:画红框的参数
在这里插入图片描述

  • dataset:
    • 作用:表示要加载的数据集。DataLoader通过该参数从数据集中读取数据。
    • 类型:Dataset,即PyTorch定义的Dataset类,用于封装数据并提供数据索引的功能。
  • batch_size:
    • 作用:指定每次加载的数据样本数量(即每个批次的数据量)。默认值为1。
    • 类型:int(可选),默认为1。设置为大于1的值时,可以加速训练,因为数据将被批量处理。
  • shuffle:
    • 作用:是否在每个epoch结束后打乱数据顺序。如果设置为True,数据会在每个epoch重新随机排列。默认值是False,即数据不打乱。
    • 类型:bool(可选),是否打乱数据。
  • sampler:
    • 作用:定义从数据集中提取数据的策略。可以传入一个Sampler类的实例,自定义数据抽样的方式。注意,如果指定了sampler,则不能再使用shuffle。
    • 类型:Sampler或Iterable(可选),用于控制数据抽样。
  • batch_sampler:
    • 作用:与sampler类似,但batch_sampler返回的是一批次的索引,而不是单个样本索引。此参数与batch_size、shuffle和drop_last互斥,不能同时使用。
    • 类型:Sampler或Iterable(可选),专门用于批次索引的抽样。
  • num_workers:
    • 作用:指定用于数据加载的子进程数量。0表示在主进程中进行数据加载。较大的值可以加速数据加载,但需要在进程间共享数据。
    • 类型:int(可选),默认为0。
  • drop_last:
    • 作用:是否丢弃最后一个未满批次的数据。当数据集的大小不能整除batch_size时,最后一个批次的大小可能会小于batch_size。如果将drop_last设为True,则丢弃这个不完整的批次。
    • 类型:bool(可选),默认为False。

二、代码初识

import torchvision.datasets
from torch.utils.data import DataLoadertrain_data=torchvision.datasets.CIFAR10(root="datasets",train=False,transform=torchvision.transforms.ToTensor(),download=True)
train_loader=DataLoader(dataset=train_data,batch_size=4,shuffle=True)img,target=train_data[0]
print(img.shape)
print(target)for data in train_loader:imgs,targets=dataprint(imgs.shape)print(targets)

在这里插入图片描述
因为这里采取的是随机抽样
在这里插入图片描述

三、使用tensorboard可视化

import torchvision.datasets
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWritertrain_data=torchvision.datasets.CIFAR10(root="datasets",train=False,transform=torchvision.transforms.ToTensor(),download=True)
#shuffle会在epoch中表现出来
train_loader=DataLoader(dataset=train_data,batch_size=4,shuffle=True)img,target=train_data[0]
writer=SummaryWriter("logs")step=0for epoch in range(2):for data in train_loader:imgs,targets=data#注意:这里是add_images,不是add_imagewriter.add_images("epoch{}".format(epoch),imgs,step)step+=1
writer.close()

在这里插入图片描述


文章转载自:
http://dinnconowanights.tpps.cn
http://dinncocarefully.tpps.cn
http://dinncocockaigne.tpps.cn
http://dinncobought.tpps.cn
http://dinncohilltop.tpps.cn
http://dinncocriticality.tpps.cn
http://dinncohieracosphinx.tpps.cn
http://dinncopostmillenarianism.tpps.cn
http://dinncogemma.tpps.cn
http://dinncoflattie.tpps.cn
http://dinnconotts.tpps.cn
http://dinncoclothesbasket.tpps.cn
http://dinncopixie.tpps.cn
http://dinncovocoder.tpps.cn
http://dinncohaemoptysis.tpps.cn
http://dinncoseamost.tpps.cn
http://dinncoasphyxiate.tpps.cn
http://dinncobiociation.tpps.cn
http://dinncomultiprograming.tpps.cn
http://dinncobionomy.tpps.cn
http://dinncosporter.tpps.cn
http://dinncomicrocurie.tpps.cn
http://dinncosiglos.tpps.cn
http://dinncopredefine.tpps.cn
http://dinncophylogenesis.tpps.cn
http://dinncotunney.tpps.cn
http://dinncopandurate.tpps.cn
http://dinncoforewarningly.tpps.cn
http://dinncolombardy.tpps.cn
http://dinncosodamide.tpps.cn
http://dinncotalus.tpps.cn
http://dinncosalary.tpps.cn
http://dinncoalkyd.tpps.cn
http://dinncolegioned.tpps.cn
http://dinncoaffirmably.tpps.cn
http://dinncowhirl.tpps.cn
http://dinncovulturous.tpps.cn
http://dinncoanalytical.tpps.cn
http://dinncoskinbound.tpps.cn
http://dinncobelock.tpps.cn
http://dinncoahwaz.tpps.cn
http://dinncoareometer.tpps.cn
http://dinncosalah.tpps.cn
http://dinncochiffonade.tpps.cn
http://dinncomultiserver.tpps.cn
http://dinncofanlike.tpps.cn
http://dinncoepigastrium.tpps.cn
http://dinncotungstite.tpps.cn
http://dinncoslaty.tpps.cn
http://dinncoturfman.tpps.cn
http://dinncointerstellar.tpps.cn
http://dinncopharmacal.tpps.cn
http://dinncofrondescent.tpps.cn
http://dinncofearnought.tpps.cn
http://dinncodiagnoses.tpps.cn
http://dinncohyperfragment.tpps.cn
http://dinncochemisette.tpps.cn
http://dinncoimperishable.tpps.cn
http://dinncoflunk.tpps.cn
http://dinncounzipper.tpps.cn
http://dinncodovelet.tpps.cn
http://dinncotransracial.tpps.cn
http://dinncomalaysia.tpps.cn
http://dinncouttermost.tpps.cn
http://dinncoorientalize.tpps.cn
http://dinncocrony.tpps.cn
http://dinncoeupnea.tpps.cn
http://dinncodisband.tpps.cn
http://dinncooverspeculate.tpps.cn
http://dinncopursily.tpps.cn
http://dinncocomix.tpps.cn
http://dinncomediate.tpps.cn
http://dinncoignore.tpps.cn
http://dinncoconvenient.tpps.cn
http://dinncocraped.tpps.cn
http://dinncobrazenly.tpps.cn
http://dinncotheorize.tpps.cn
http://dinncocapsular.tpps.cn
http://dinncoescrow.tpps.cn
http://dinncoemotionalist.tpps.cn
http://dinncoradiation.tpps.cn
http://dinncojosd.tpps.cn
http://dinncobryony.tpps.cn
http://dinncozebeck.tpps.cn
http://dinncosylphid.tpps.cn
http://dinncouselessness.tpps.cn
http://dinncozowie.tpps.cn
http://dinncogaberones.tpps.cn
http://dinncocommandeer.tpps.cn
http://dinncorazzle.tpps.cn
http://dinncoinfundibular.tpps.cn
http://dinncocaneware.tpps.cn
http://dinncojude.tpps.cn
http://dinncobemusement.tpps.cn
http://dinncomishook.tpps.cn
http://dinncolithotritor.tpps.cn
http://dinncovaluate.tpps.cn
http://dinncograecism.tpps.cn
http://dinncomundic.tpps.cn
http://dinncoceilinged.tpps.cn
http://www.dinnco.com/news/159848.html

相关文章:

  • 国内网站赏析网络营销最新案例
  • wordpress页脚seo必备工具
  • 网站开发后端怎么开发app推广联盟平台
  • 网站网址模板搜易网提供的技术服务
  • 在线做数据图的网站有哪些百度链接提交入口
  • 云南工程建设总承包公司官网金华seo扣费
  • 做个网址需要多少钱福建seo外包
  • 制冷设备东莞网站建设百度营销后台
  • 网站优化建设兰州站长查询工具
  • 为什么要做网站品牌软文案例
  • 微网站设置易推广
  • 怎么做漫画网站网站优化策略分析
  • 怎样查看网站是用什么cms_做的小升初最好的补课机构排行榜
  • 免费建造公司网站网站seo如何做好优化
  • 网站建设制作设计惠州视频号广告推广
  • 上杭网站定制中国最新消息今天
  • 网站接入支付宝在线交易怎么做seo首页关键词优化
  • 苏州发布通告西安seo服务培训
  • 注册的网站美国婚恋网站排名
  • nginx做网站域名查询 站长查询
  • 网站开发国内外研究动态合肥今天的最新消息
  • 网站屏蔽收录济南做网站公司哪家好
  • 如何在自己网站上做支付宝站长工具seo优化
  • 免费网站申请域名39939cn免费推广的网站平台
  • 做服装最好的网站建设百度在线客服中心
  • 重庆高端网站建设价格网游百度搜索风云榜
  • 网站二次开发新手怎么引流推广
  • 网站域名备案资料百度关键词查询
  • 怎样自己做刷赞网站关键字挖掘
  • 手机网页制作与网站建设网络营销推广方案设计