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

无锡快速建设网站方法手机优化大师怎么退款

无锡快速建设网站方法,手机优化大师怎么退款,软文世界平台,分析网站设计1. 基础资料汇总 资料汇总 pytroch中文版本教程 PyTorch入门教程 B站强推!2023公认最通俗易懂的【PyTorch】教程,200集付费课程(附代码)人工智能_机器 视频 1.PyTorch简介 2.PyTorch环境搭建 basic: python numpy pandas pytroch…

1. 基础资料汇总

资料汇总
pytroch中文版本教程
PyTorch入门教程
B站强推!2023公认最通俗易懂的【PyTorch】教程,200集付费课程(附代码)人工智能_机器
视频
1.PyTorch简介
2.PyTorch环境搭建
basic: python numpy pandas pytroch

在这里插入图片描述

theory: study mlp cnn transform rnn

model: AlexNet VGG ResNet Yolo SSD

2. Tensor张量初始化与基本操作(numpy对比)

2.1 tensor 创建的集中基本方式
import numpy as np
import torchnp_a = np.array([1,2,3]) #ndarrays
tensor_a = torch.tensor([1,2,3]) #tensor
# tensor function and computer
tensor_b = torch.empty(5,3)
tensor_c = torch.randn(5,3) #用于确定模型的输入维度,做数据头尾
tensor_d = torch.zeros(5,3)  #用于 x->y 训练的一个映射 神经网络y truth_label one_hot表示
tensor_e = torch.zeros(5,3,dtype= torch.long) # dtype 数据格式print("np_a",np_a)
print("tensor_a", tensor_a)
print("tensor_b", tensor_b)
print("tensor_c", tensor_c)
print("tensor_d", tensor_d)
print("tensor_e", tensor_e)

在这里插入图片描述

import torch#通过数据直接创建张量:
data = [[1, 2, 3], [4, 5, 6]]
tensor1 = torch.tensor(data)
print("tensor1",tensor1)#使用特定形状的全零张量:
import torch
tensor2 = torch.zeros(2, 3)
print("tensor2",tensor2)#使用特定形状的全一张量:
import torch
tensor3 = torch.ones(2, 3)
print("tensor3",tensor3)#利用随机数创建张量:
import torch
tensor4 = torch.rand(2, 3)
print("tensor4",tensor4)

在这里插入图片描述

2.2 修改tensor/numpy长度与维度
# 基于已经存在的 tensor进行操作
x = torch.tensor([1,2,3]) 
x.new_ones(5,3)  # 修改 x 的维度tensor_f = torch.randn_like(x,dtype=torch.float) # 修改x 的类型与维度
print("tensor_f = ", tensor_f)# 维度查看 np  shape   |  tensor size 层到另外一个层 矩阵相乘
np.array([1, 2, 3]).shape
torch.tensor([1,2,3]).size()

在这里插入图片描述

# 更改维度 np reshape 
y.size()y.view(15)y.view(15,1)y.view(-1,5) # -1 表示自动计算,根据总维度/5得到

在这里插入图片描述

2.3 取 tensor/numpy 元素
y = np.array([[1,2,3],[4,5,6]])np.array([[1,2,3],[4,5,6]])[0]
np.array([[1,2,3],[4,5,6]])[0,:] #":"表示不指定行,默认为该行所有np.array([[1,2,3],[4,5,6]])[:,0]
print(y[:,0])  # 取第一列
print(y[0,:])  # 取第一行y[3,0].item() # 常用 loss 反向传导 日志 打印查看 loss 是否减少 查看具体数值

在这里插入图片描述

2.4 numpy 对象的基本运算
import numpy as np# 加法
result_array_add = np.array([1, 2]) + np.array([3, 4])# 减法
result_array_sub = np.array([1, 2]) - np.array([3, 4])# 乘法
result_array_mul = np.array([1, 2]) * np.array([3, 4])# 除法
result_array_div = np.array([1, 2]) / np.array([3, 4])# 数乘
result_array_scalar_mul = 2 * np.array([3, 4])# 内积
result_array_dot = np.dot(np.array([1, 2]), np.array([3, 4]))# 外积
result_array_outer = np.outer(np.array([1, 2]), np.array([3, 4]))print("add = ", result_array_add)
print("sub = ", result_array_sub)
print("mul = ", result_array_mul)
print("div = ", result_array_div)
print("scalar_mul = ", result_array_scalar_mul)
print("dot = ", result_array_dot)
print("outer = ", result_array_outer)

在这里插入图片描述

2.5 tensor 对象的基本运算
import torch# 加法
result_tensor_add = torch.tensor([1, 2]) + torch.tensor([3, 4])# 减法
result_tensor_sub = torch.tensor([1, 2]) - torch.tensor([3, 4])# 乘法
result_tensor_mul = torch.tensor([1, 2]) * torch.tensor([3, 4])# 除法
result_tensor_div = torch.tensor([1, 2], dtype=torch.float) / torch.tensor([3, 4], dtype=torch.float)# 数乘
result_tensor_scalar_mul = 2 * torch.tensor([3, 4])# 内积
result_tensor_dot = torch.dot(torch.tensor([1, 2]), torch.tensor([3, 4]))# 外积
result_tensor_outer = torch.ger(torch.tensor([1, 2]), torch.tensor([3, 4]))print("add = ", result_tensor_add)
print("sub = ", result_tensor_sub)
print("mul = ", result_tensor_mul)
print("div = ", result_tensor_div)
print("scalar_mul = ", result_tensor_scalar_mul)
print("dot = ", result_tensor_dot)
print("outer = ", result_tensor_outer)

在这里插入图片描述

http://www.yayakq.cn/news/954412/

相关文章:

  • 塑胶卡板东莞网站建设支持东莞五镇只进不出
  • crm系统 网站建设海洋馆网站建设
  • 免费建立个人视频网站公司做网站推广要注意什么
  • 英文网站建设方案 ppt模板edge网页视频怎么下载
  • 有什么类似凡科建站浙江省建设信息港网
  • 网站源码做exe执行程序玉溪市规划建设局网站
  • 自己建设网站需要审核吗wordpress多语模板
  • 专业群建设专题网站工业设计是干什么的
  • 积玉桥网站建设网站怎么做才有百度权重
  • 西安域名注册网站建设青岛仿站定制模板建站
  • 做网站带来的好处北京网站开发一般多少钱
  • 网站外链数怎么查有哪些做网站的网站
  • 塑胶卡板东莞网站建设支持搭建网站需要学什么软件
  • 网站建设费无形资产摊销企业宣传册设计与制作
  • 网站下载软件企业是如何做电子商务网站
  • 顺德高端网站自己做网站赚佣金
  • 企业网站建设内容 程序开发网络推广与优化
  • ps怎么做网站首页和超链接wordpress左边菜单
  • 易思企业网站wordpress增加板块
  • 大悟网站设计学雷锋 做美德少年网站
  • 企业免费网站模板网站建设和网站设计区别
  • 如何搭建网站建设环境酷播wordpress视频插件
  • 做网站 不做源码网站建设单位是什么
  • 电商网站平台有哪些功能模块网络设计师好找工作吗
  • 河北网站制作公司哪家好合肥网络推广
  • 网站安排saas平台
  • 外贸网站seo推广数据网站怎么做的
  • 吉林省延边州建设局网站网站备案 申请
  • 有学做美食的网站吗网站开发面试内容
  • asp 通过ftp 网站搬家专业网页网站设计图书