自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 一个月Pytorch笔记

一个月Pytorch从入门到实践学习时间:学习内容:3-2 张量,标量,向量,矩阵3-3 tensor创建理论3-4 tensor创建代码3-5 tensor创建代码学习总结:学习时间:1、 周六上午 9 点-上午 12 点2、学习内容:3-2 张量,标量,向量,矩阵3-3 tensor创建理论tensor 类型 torch.float ; torch.bool ; torch.int tensor创建 3-4 tensor创建代码import torch

2020-10-28 08:54:49 136

原创 波斯顿房价 (1)

#房价预测import torch#dataimport numpy as npimport reff = open(r"C:\Users\22383\Desktop\备份pytorch\000、课程配套资料\Pytorch_code-master\pytorch_code\04\cls_reg\housing.data").readlines()data = []for item in ff: out = re.sub(r"\s{2,}", " ", item).strip()

2020-11-01 17:36:38 156 1

原创 pytorch任课(第三章)

import torch#torch.wherea = torch.rand(4, 4)b = torch.rand(4, 4)print(a)print(b)tensor([[0.4295, 0.4639, 0.1673, 0.8253], [0.6463, 0.0885, 0.6070, 0.9644], [0.3394, 0.3260, 0.6519, 0.7562], [0.7720, 0.7656, 0.3653, 0.3863]]

2020-10-29 22:34:00 146

原创 3-11比较运算-排序

import torcha = torch.rand(2, 3)b = torch.rand(2, 3)print(a)print(b)tensor([[0.2165, 0.9520, 0.2256], [0.0793, 0.1522, 0.3120]])tensor([[0.8147, 0.2384, 0.1755], [0.6711, 0.9985, 0.4503]])#维度相同才可以比较print(torch.eq(a, b)) #返回一个te

2020-10-28 10:51:25 92

原创 3-10取整取余运算

import torcha = torch.rand(2, 2)a = a * 10print(a)print(torch.floor(a)) #向下取整print("-----\n",a)print(torch.ceil(a)) #向上取整print(torch.round(a)) #四舍五入print(torch.trunc(a)) #留整数部分print(torch.frac(a))

2020-10-28 10:05:30 1618

原创 3-9广播机制

import torcha = torch.rand(2, 2)b = torch.rand(1, 2)# a, 2*1# b, 1*2# c, 2*2# 2*4*2*3c = a + bprint(a)print(b)print(c)print(c.shape)tensor([[0.3246, 0.0065], [0.5726, 0.3850]])tensor([[0.3750, 0.1614]])tensor([[0.6996, 0.1680],

2020-10-28 09:41:21 54

原创 3-8tensor算术运算编程

import torch##adda = torch.rand(2, 3)b = torch.rand(2, 3)print(a)print(b)print(a + b)print(a.add(b))print(torch.add(a, b))print(a)print(a.add_(b))print(a)tensor([[0.8129, 0.6266, 0.2343], [0.4351, 0.9933, 0.0969]])tensor([[0.4357

2020-10-28 09:30:43 120 1

原创 3-4 tensor 创建

import torch# 1 直接定义a=torch.Tensor([[1,2],[3,4]])print(a)print(a.type())#type 有括号tensor([[1., 2.], [3., 4.]])torch.FloatTensor# 2 通过shape定义,值随机a=torch.Tensor(2,3) # 无括号print(a)print(a.shape) tensor([[ 0.0000e+00, -1.1152e-01, 5.2

2020-10-24 10:30:11 116

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除