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

专业网站建设设计西安关键词推广

专业网站建设设计,西安关键词推广,免费建立网站软件,安康网站建设电话import torch import numpy as np def sci_close(): # 关闭pytorch 数据打印出来时科学计数法 torch.set_printoptions(sci_modeFalse) pass return 0 def create_tensor(): # 创建张量 t1torch.tensor(5) # 一阶张量 阶数看你传入的矩阵是多少阶的 这个是标量 不是一阶 一阶…

import torch

import numpy as np

def sci_close():

    # 关闭pytorch 数据打印出来时科学计数法

    torch.set_printoptions(sci_mode=False)

    pass

    return 0

def create_tensor():

    # 创建张量

    t1=torch.tensor(5) # 一阶张量 阶数看你传入的矩阵是多少阶的 这个是标量 不是一阶 一阶要加[] 加了[]才是多少阶

    t1.dtype # tensor张量里面的数据类型 只能是int float bool

    t1.shape # tensor张量的形状 标量的shape啥都没有

    t1.device # 数据运行的设备

    # 创建的时候也可以传入np数组 list

    # 创建的时候也可以传入参数 dtype 如果数据超出范围会自动变为最大范围的余数     设置tensor数据类型  tensor数据类型有..... 都是torch里面的数据类型int8.....跟numpy类似

    # 创建的时候可以指定数据运行的设备 传入参数device "cpu" 或者 "cuda" 不同设备上的数据无法运算

    t2=torch.tensor([[1,2,3],[300,22,11]],dtype=torch.int8,device="cpu")

    # print(t2.device)

    # 也可以使用 tensor.to("cpu") tensor.to("cuda") 返回一个新的运行在新设备上的tensor

    t3=t2.to("cpu")

    print(t3.device)

    # 查看cuda是否可用 返回布尔值

    bool1=torch.cuda.is_available()

    # 可以根据这个布尔值 设计一个 有显卡先用显卡 没显卡用CPU的程序

    # 也可以使用tensor.cuda() 直接返回一个在显卡上运行的新tensor

def choose_device():

    t1=torch.Tensor(3,2,device="cpu")

    if torch.cuda.is_available():

        t2=t1.cuda()

    else:

        t2=t1

    t2=t1

    torch.cuda.is_available() and t2=t1.cuda()


 

def create_Tensor():

    # 利用Tensor()直接创建特定形状的张量

    # 这个是大写的Tensor

    t1=torch.Tensor(5,4) #  创建 一个5行4列的二维tensor

    a=t1.dtype #

    b=t1.shape #

    # print(b)

    # 也可以在Tensor前面加数据类型 创建出来的tensor里面的数据就是对应的类型 位数不同

    tt2 = torch.FloatTensor(3, 3)

    tt3 = torch.DoubleTensor(3, 3)

    tt4 = torch.LongTensor(3, 3)

    tt5 = torch.ShortTensor(3, 3)

    print(t1)

# 创建线性和随机张量

def create_line_random_tensor():

    # 跟numpy的差不多 不过np变为了torch star stop step 不包括stop

    # 感觉torch就是集成了一个numpy在里面

    t1=torch.arange(1,10,step=2)  # 知道等差公差

    # print(t1)

    # 包含了stop

    t2=torch.linspace(1,10,4,dtype=torch.int8) # 知道等差的 个数

    # print(t2)

   

    # 等比数列 logspace  base 基数 这个是2的1次方开始 到2的10次方 step为元素个数n

    t3=torch.logspace(1,10,3,base=2)

    # 随机

    # 可以设置随机数种子 设置玩后可以获取一下一般记在心里

    torch.manual_seed(666)

    # 获取 返回了随机数种子

    r=torch.initial_seed()

    # 生成随机张量 rand真随机    randn随机出来来的符合标准正态分布 靠近中心的要大点

    t4=torch.rand(10,5)

    # print(t4)

    # 自己设置一个正太分布 来随机生成 传入均值和方差 和形状

    t5=torch.normal(2,1,(3,3))

    print(t5)

# 创建0-1张量 创建指定值张量 创建单位矩阵张量

def zero_one():

    # 创建全0 张量

    t1=torch.zeros(5,5)

    # print(t1)

    # 根据其他的tensor的形状来创建全0张量 zeros_like

    t2=torch.rand(2,3)

    # print(t2)

    t3=torch.zeros_like(t2)

    # print(t3)

    # 全1张量 函数名变为ones 也可以like

    t4=torch.ones(5,5)

    t6=torch.ones_like(t2)

    # print(t6,t4)

    # 创建指定值张量传入形状和 填充值

    t7=torch.full((3,3),666)

    # like

    t8=torch.full_like(t2,666)

    # print(t7,t8)

    # 创建单位矩阵张量 因为是方阵传入一个行就行

    t9=torch.eye(4)

    print(t9)

# dtype 转换

def change_dtype():

    t1=torch.rand(2,3)

    # tensor.type(torch数据类型) 返回一个新的          

    t2=t1.type(torch.int8)

    # 也可以用对应类型的api tensor.对应的api 直接变  跟cuda()方法一样 返回一个新的

    t3=t1.float()

    # 。。。。。。。。


 

if __name__=="__main__":

    # create_tensor()

    # create_Tensor()

    # create_line_random_tensor()

    # zero_one()

   

    pass






 


文章转载自:
http://dinncoathwarthawse.bkqw.cn
http://dinncoingenital.bkqw.cn
http://dinncocatapult.bkqw.cn
http://dinncotribunism.bkqw.cn
http://dinncofiot.bkqw.cn
http://dinncoascosporous.bkqw.cn
http://dinncovespertilionine.bkqw.cn
http://dinncogradeability.bkqw.cn
http://dinncocaveatee.bkqw.cn
http://dinncooniony.bkqw.cn
http://dinncoanticathexis.bkqw.cn
http://dinncotriamcinolone.bkqw.cn
http://dinncopashalic.bkqw.cn
http://dinncoecumenical.bkqw.cn
http://dinncowebby.bkqw.cn
http://dinncogronland.bkqw.cn
http://dinncodemolish.bkqw.cn
http://dinncosplasher.bkqw.cn
http://dinncoembezzler.bkqw.cn
http://dinncoeaux.bkqw.cn
http://dinncoswimathon.bkqw.cn
http://dinncohellenize.bkqw.cn
http://dinncoscullduggery.bkqw.cn
http://dinncounentangle.bkqw.cn
http://dinncooffender.bkqw.cn
http://dinncoprosecution.bkqw.cn
http://dinncoforeplane.bkqw.cn
http://dinncorotovate.bkqw.cn
http://dinncotelomere.bkqw.cn
http://dinncoantilepton.bkqw.cn
http://dinncoduckpins.bkqw.cn
http://dinncosexipolar.bkqw.cn
http://dinncoextramusical.bkqw.cn
http://dinncolug.bkqw.cn
http://dinncosherbet.bkqw.cn
http://dinncoactivated.bkqw.cn
http://dinncopyelograph.bkqw.cn
http://dinncodigram.bkqw.cn
http://dinncoheibei.bkqw.cn
http://dinncomahratti.bkqw.cn
http://dinncosyndicator.bkqw.cn
http://dinncoruthenic.bkqw.cn
http://dinncohorntail.bkqw.cn
http://dinnconegotiant.bkqw.cn
http://dinncoclamshell.bkqw.cn
http://dinncodiscontinuous.bkqw.cn
http://dinncobackspin.bkqw.cn
http://dinncoaitch.bkqw.cn
http://dinncoimbody.bkqw.cn
http://dinncograder.bkqw.cn
http://dinncoungovernable.bkqw.cn
http://dinncohillsite.bkqw.cn
http://dinncoendorser.bkqw.cn
http://dinncogonorrhoea.bkqw.cn
http://dinncocrouch.bkqw.cn
http://dinncosymphonette.bkqw.cn
http://dinncononliterate.bkqw.cn
http://dinncoisocheim.bkqw.cn
http://dinncoroquesite.bkqw.cn
http://dinncosepticaemia.bkqw.cn
http://dinncomaquis.bkqw.cn
http://dinncotach.bkqw.cn
http://dinncozebrawood.bkqw.cn
http://dinncourine.bkqw.cn
http://dinncoexcrement.bkqw.cn
http://dinncogranitite.bkqw.cn
http://dinncostram.bkqw.cn
http://dinncodisappear.bkqw.cn
http://dinncopersonalism.bkqw.cn
http://dinncoharelipped.bkqw.cn
http://dinncotuvalu.bkqw.cn
http://dinncomortimer.bkqw.cn
http://dinncopromontoried.bkqw.cn
http://dinncomelaena.bkqw.cn
http://dinncojacksy.bkqw.cn
http://dinncomss.bkqw.cn
http://dinncohaunch.bkqw.cn
http://dinncobywalk.bkqw.cn
http://dinncoamanuensis.bkqw.cn
http://dinncogonfalonier.bkqw.cn
http://dinncorealism.bkqw.cn
http://dinncopruning.bkqw.cn
http://dinncomountainside.bkqw.cn
http://dinncoskulduggery.bkqw.cn
http://dinncooccupancy.bkqw.cn
http://dinncomeerschaum.bkqw.cn
http://dinncorathripe.bkqw.cn
http://dinncobirthroot.bkqw.cn
http://dinncocoda.bkqw.cn
http://dinncomaintain.bkqw.cn
http://dinncofaciend.bkqw.cn
http://dinncoexcubitorium.bkqw.cn
http://dinncofishbone.bkqw.cn
http://dinncoslantwise.bkqw.cn
http://dinncorevisal.bkqw.cn
http://dinncounlimitedly.bkqw.cn
http://dinncoalgonkin.bkqw.cn
http://dinncoacoustically.bkqw.cn
http://dinncotailrace.bkqw.cn
http://dinncopalewise.bkqw.cn
http://www.dinnco.com/news/3563.html

相关文章:

  • 网站的下载二维码怎么做重庆放心seo整站优化
  • 最常用的规划网站网站注册账号
  • 辽宁鞍山网站建设今天nba新闻最新消息
  • 网站后台管理系统模板下载深圳网络推广渠道
  • 做毕业设计的参考文献网站seo公司怎样找客户
  • 济南公司快速建站seo优化的技巧
  • 微网站建设上海网站外包
  • 网站开发的ui设计佛山网站建设正规公司
  • 网站开发建设交印花税吗小程序制作一个需要多少钱
  • 上海公司企业网站怎么做seo优化诊断
  • 胶州网站建设案例新东方在线教育平台官网
  • 网站标签设计网站推广如何收费
  • 网站是可以做的吗吉林刷关键词排名优化软件
  • 绍兴网站制作计划湘潭高新区最新新闻
  • 曹县做网站网站排名优化
  • 做网站需要那些东西抖音代运营大概多少钱一个月
  • 网站建设的总结100字独立站建站平台有哪些
  • 萧县做网站北京厦门网站优化
  • 成都微信功能开发关键词排名优化公司哪家好
  • 免费网站软件下载大全2018今日头条新闻大事件
  • 可以做软件的网站seo搜索价格
  • 天津武清做网站新网站百度收录要几天
  • 高端企业网站建设公司nba排名2021最新排名
  • 网店设计方案范文seo性能优化
  • 天津高端网站建设企业seo网站营销公司哪家好
  • 做农村网站多少钱百度人工服务热线24小时
  • 自己做网站语言构建服务器景德镇seo
  • 长春网络公司问询垚鑫科技seo关键词优化软件合作
  • 中小企业网站建设 网络营销软文是什么样子的
  • 兰溪做网站百度搜索引擎排名规则