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

莱芜信息招聘平台宁波网站建设优化

莱芜信息招聘平台,宁波网站建设优化,珠海市品牌网站建设哪家好,嘉兴网页设计培训PyTorch的基本概念 Tensor的基本概念 张量高于标量、向量、矩阵 标量说零维的张量#xff0c;向量是一维的张量#xff0c;矩阵是二维的张量 Tensor与机器学习的关系 Tensor的创建 函数功能Tensor(*size)基础构造函数Tensor(data)类似np.arrayones(*size)全1Tensorzeros(…PyTorch的基本概念 Tensor的基本概念 张量高于标量、向量、矩阵 标量说零维的张量向量是一维的张量矩阵是二维的张量 Tensor与机器学习的关系 Tensor的创建 函数功能Tensor(*size)基础构造函数Tensor(data)类似np.arrayones(*size)全1Tensorzeros(*size)全0Tensoreye(*size)对角线为1其他为0arange(s,e,step)从s到e步长为steplinspace(s,e,steps)从s到e均匀切分成steps份rand/randn(*size)均匀/标准分布normal(mean,std)/uniform_(from,to)正态分布/均匀分布randperm(m)随机排列 实例 随机数 正态分布 标准分布 序列 Tensor的属性 每一个Tensor有torch.dtype、torch.device、torch.layout三种属性torch.device 标识了torch.Tensor对象在创建之后所存储在的设备名称torch.layout表示torch.Tensor内存布局的对象 torch.tensor([1,2,3],dtypetorch.float32,devicetorch.device(cpu))稀疏的张量 torch.sparse_coo_tensorcoo类型表示了非零元素的坐标形式 indices torch.tensor([0,1,1],[2,0,2]]) values torch.tensor([3,4,5],dtypetorch.float32) x torch.sparse_coo_tensor(i,v,[2,4])dev torch.device(cpu) torch.tensor([2,2],devicedev) torch.tensor([2,2],dtypetorch.float32,devicedev)稀疏的张量 itorch.tensor([[0,1,2],[0,1,2]]) vtorch.tensor([1,2,3]) torch.sparse_coo_tensor(i,v,(4,4))转成稠密的张量 torch.sparse_coo_tensor(i,v,(4,4)).to_dense()Tensor的算术运算 加法运算 cab ctorch.add(a,b) a.add(b) a.add_(b)#会修改a的值减法运算 ca-b ctorch.sub(a,b) a.sub(b) a.sub_(b)#会修改a的值乘法运算 哈达玛积element wise对应元素相乘 ca*b ctorch.mul(a,b) a.mul(b) a.mul_(b)除法运算 ca/b ctorch.div(a,b) a.div(b) a.div_(b)矩阵运算 二维矩阵乘法运算操作包括torch.mm()、torch.matmul()、 atorch.ones(2,1) btorch.ones(1,2) print(torch.mm(a,b)) print(torch.matmul(a,b)) print(ab) print(a.matmul(b)) print(a.mm(b))对于高维的Tensordim2定义其矩阵乘法仅在最后的两个维度上要求前面的维度必须保持一致就像矩阵的索引一样并且运算操作只有torch.matmul() atorch.ones(1,2,3,4) btorch.ones(1,2,4,3) print(a.matmul(b)) print(torch.matmul(a,b))幂运算 print(torch.pow(a,2)) print(a.pow(2)) print(a**2) print(a.pow_(2))e的n次方 print(torch.exp(a)) ba.exp_()开方运算 a.sqrt() a.sqrt_()对数 torch.log2(a) torch.log10(a) torch.log(a) torch.log_(a)Tensor的取整/取余运算 .floor()向下取整数.ceil()向上取整数.round()四舍五入.trunc()裁剪只取整数部分.frac()只取小数部分%取余 Tensor的比较运算 torch.eq(input,other, outNone) #按成员进行等式操作相同返回True torch.equal(tensor1,tensor2) #如果tensor1和tensor2有相同的size和elements则为true torch.ge(input, other, outNone) #input other torch.gt(input, other, outNone) #inputother torch.le(input, other, outNone) #inputother torch.lt(input, other, outNone) #inputother torch.ne(input, other, outNone) #input ! other 不等于排序 torch.sort(input, dimNone, descendingFalse, outNone) #对目标input进行排序 torch.topk(input, k,dimNone, largestTrue, sortedTrueoutNone) #沿着指定维度返回最大k个数值及其索引值 torch.kthvalue(input, k, dimNone, outNone) #沿着指定维度返回第k个最小值及其索引值Tensor判定是否为finite/inf/nan torch.isfinite(tensor)/torch.isinf(tensor)/torch.isnan(tensor) 返回一个标记元素是否为 finite/inf/nan 的mask 张量 Tensor的三角函数 torch.abs(input, outNone)torch.acos(input, outNone)torch.asin(input, outNone)torch.atan(input, outNone)torch.atan2(input, inpu2outNone)torch.cos(input, outNone)torch.cosh(input, outNone)torch.sin(input, outNone)torch.sinh(input, outNone)torch.tan(input, outNone)torch.tanh(input, outNone)
http://www.pierceye.com/news/391056/

相关文章:

  • 网站空间文件删不掉软文免费发布平台
  • 电子商务网站开发教程论文推广app平台有哪些
  • 郑州专业的网站建设优化自己的网站
  • 申请渠道门户网站是什么意思微信公众平台推广网站
  • 公司网站未备案公众号如何推广产品
  • 网站建设服务器环境配置郑州网站建设企业名录
  • e福州官方网站wordpress注册目录
  • 国际外贸网络交易平台网页seo搜索引擎优化
  • 做网做网站建设网站建设图片怎么切
  • 国外数码印花图案设计网站36kr wordpress
  • 上海网站建设设计公司zencart 网站入侵
  • 阜蒙县自治区建设学校网站汉中市住建局建设厅网站官网
  • windows 2008 iis怎么搭建网站手机网站模板建站
  • 优设网官网首页seo教程搜索引擎优化
  • 做问卷给钱的网站页面设计结课总结
  • 洛阳集团网站建设wordpress 深度优化
  • python做网站缺点湛江市建网站
  • 济南网站建设(选聚搜网络)在线购物网站建设
  • 珠海专业做网站公司昆明搜索引擎推广
  • 阿里云 建设网站怎么样百度推广一级代理商名单
  • 湛江网站制作网站吉林省四平市网站建设
  • 酒店网站建设公司推广方法有哪些
  • 网站建设免备案免费空间wordpress在线教育主题购买
  • 网站后台验证码不显示成都市建设工程施工安监站网站
  • 榆林网站优化做图的网站
  • 在微信中做网站淄博 网站seo优化
  • 黑龙江省建设协会网站首页怎么用word做网站
  • 企业网站网站建设价格wordpress阶梯插件
  • 企业品牌建设方案范文roseonly企业网站优化
  • 电影资源采集网站咋做在百度上怎么建立网站吗