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

做翻译网站 知乎seo关键词排名公司

做翻译网站 知乎,seo关键词排名公司,广西壮族自治区绕口令,中国设计公司排名前十强RNN 特点:输入层是层层相关联的,输入包括上一个隐藏层的输出h1和外界输入x2,然后融合一个张量,通过全连接得到h2,重复 优点:结构简单,参数总量少,在短序列任务上性能好 缺点&#x…

RNN

特点:输入层是层层相关联的,输入包括上一个隐藏层的输出h1和外界输入x2,然后融合一个张量,通过全连接得到h2,重复
优点:结构简单,参数总量少,在短序列任务上性能好
缺点:在长序列中效果不好,容易梯度提升或者爆炸

import torch
import torch.nn as nn
import torch.nn.functional as F# 参数一: 输入张量的词嵌入维度5, 参数二: 隐藏层的维度(也就是神经元的个数), 参数三: 网络层数
rnn = nn.RNN(5, 6, 2)# 参数一: sequence_length序列长度, 参数二: batch_size样本个数, 参数三: 词嵌入的维度, 和RNN第一个参数匹配
input1 = torch.randn(1, 3, 5)# 参数一: 网络层数, 和RNN第三个参数匹配, 参数二: batch_size样本个数, 参数三: 隐藏层的维度, 和RNN第二个参数匹配
h0 = torch.randn(2, 3, 6)output, hn = rnn(input1, h0)
# print(output.shape)
# torch.Size([1, 3, 6])
# print(hn.shape)
# torch.Size([2, 3, 6])

LSTM

解决了RNN的缺点,在长序列中效果好,现在仔细研究中间图的结构

在这里插入图片描述

最左边是的黄色矩形部分是遗忘门,就是结合前一层的的h1+输入x2拼接,然后经过全连接层后输出ft,就是把之前的一些信息遗忘一部分,
在这里插入图片描述

第二第三是一部分输入门,拼接完过后经过全连接结合σ激活函数it,以及拼接后用一个tanh激活函数ct,然后和上一层的结合起来
在这里插入图片描述
第三部分是输出门,图的右边黄色的矩形到结尾
在这里插入图片描述
此外Bi-LSTM,是双向的,相当于运用了两层LSTM但是方向不同,前面是单向的,信息从左到右的的传递相当于考虑前面的信息,Bi-LSTM是左右信息都考虑,然后拼接结果

# -------------------------------------
import torch
import torch.nn as nnlstm=nn.LSTM(5,6,2)
input=torch.randn(1,3,5)
h0=torch.randn(2,3,6)
c0=torch.randn(2,3,6)
output,(hn,cn)=lstm(input,(hn,cn))#-------------------------class Attention(nn.Module):def __init__(self, query_size, key_size, value_size1, value_size2, output_size):super(Attention, self).__init__()self.query_size = query_sizeself.key_size = key_sizeself.value_size1 = value_size1self.value_size2 = value_size2self.output_size = output_sizeself.attn = nn.Linear(self.query_size + self.key_size, self.value_size1)self.attn_combine = nn.Linear(self.query_size + self.value_size2, self.output_size)def forward(self, Q, K, V):attn_weights = F.softmax(self.attn(torch.cat((Q[0], K[0]), 1)), dim=1)attn_applied = torch.bmm(attn_weights.unsqueeze(0), V)output = torch.cat((Q[0], attn_applied[0]), 1)output1 = self.attn_combine(output).unsqueeze(0)return output1, attn_weightsquery_size = 32
key_size = 32
value_size1 = 32
value_size2 = 64
output_size = 64
attn = Attention(query_size, key_size, value_size1, value_size2, output_size)
Q = torch.randn(1, 1, 32)
K = torch.randn(1, 1, 32)
V = torch.randn(1, 32, 64)
res = attn(Q, K, V)
# print(res[0])
# print(res[0].shape)
# print('*****')
# print(res[1])
# print(res[1].shape)# --------------------------------------------

文章转载自:
http://pecky.bnpn.cn
http://vocatively.bnpn.cn
http://role.bnpn.cn
http://mangabey.bnpn.cn
http://technification.bnpn.cn
http://godson.bnpn.cn
http://abri.bnpn.cn
http://retest.bnpn.cn
http://hexaploid.bnpn.cn
http://holophote.bnpn.cn
http://chrissie.bnpn.cn
http://pungle.bnpn.cn
http://speculation.bnpn.cn
http://mopoke.bnpn.cn
http://felspathoid.bnpn.cn
http://winy.bnpn.cn
http://pained.bnpn.cn
http://bullshot.bnpn.cn
http://embarkation.bnpn.cn
http://tedium.bnpn.cn
http://beerless.bnpn.cn
http://leptospire.bnpn.cn
http://loof.bnpn.cn
http://alcoholization.bnpn.cn
http://morphophysiology.bnpn.cn
http://henny.bnpn.cn
http://scythia.bnpn.cn
http://balibuntal.bnpn.cn
http://banaban.bnpn.cn
http://understrapper.bnpn.cn
http://moment.bnpn.cn
http://primigenial.bnpn.cn
http://unscanned.bnpn.cn
http://classless.bnpn.cn
http://almost.bnpn.cn
http://dnp.bnpn.cn
http://topline.bnpn.cn
http://microcephaly.bnpn.cn
http://recommendable.bnpn.cn
http://endville.bnpn.cn
http://barracuda.bnpn.cn
http://bennet.bnpn.cn
http://monopolist.bnpn.cn
http://eternal.bnpn.cn
http://intellectually.bnpn.cn
http://barbarous.bnpn.cn
http://furthermore.bnpn.cn
http://perceval.bnpn.cn
http://calamine.bnpn.cn
http://aspherical.bnpn.cn
http://polling.bnpn.cn
http://correligionist.bnpn.cn
http://goldsmithry.bnpn.cn
http://bht.bnpn.cn
http://chessman.bnpn.cn
http://pm.bnpn.cn
http://tachygrapher.bnpn.cn
http://mucific.bnpn.cn
http://scourian.bnpn.cn
http://fluorid.bnpn.cn
http://woolmark.bnpn.cn
http://aerosiderite.bnpn.cn
http://linstock.bnpn.cn
http://sailmaker.bnpn.cn
http://marianne.bnpn.cn
http://curtesy.bnpn.cn
http://peasantry.bnpn.cn
http://examinant.bnpn.cn
http://cholesterol.bnpn.cn
http://fatuous.bnpn.cn
http://tolidine.bnpn.cn
http://sausageburger.bnpn.cn
http://amerasian.bnpn.cn
http://disomic.bnpn.cn
http://pathetical.bnpn.cn
http://iby.bnpn.cn
http://drizzle.bnpn.cn
http://discontinuous.bnpn.cn
http://mantlet.bnpn.cn
http://irresolvable.bnpn.cn
http://liassic.bnpn.cn
http://asap.bnpn.cn
http://machine.bnpn.cn
http://rad.bnpn.cn
http://paramilitary.bnpn.cn
http://astrogate.bnpn.cn
http://porism.bnpn.cn
http://armillary.bnpn.cn
http://interoceanic.bnpn.cn
http://enigmatize.bnpn.cn
http://temporize.bnpn.cn
http://amperemeter.bnpn.cn
http://trinitarian.bnpn.cn
http://swatantra.bnpn.cn
http://shipment.bnpn.cn
http://yahveh.bnpn.cn
http://paroxysm.bnpn.cn
http://schilling.bnpn.cn
http://peacenik.bnpn.cn
http://containment.bnpn.cn
http://www.dt0577.cn/news/89811.html

相关文章:

  • 网站上做网上支付功能济南seo培训
  • 手游源码网站seo是什么意思?
  • 郑州公司网站建设搜索引擎关键词优化技巧
  • 卖环保设备做哪个网站好天津优化代理
  • 青岛专业做网站站长检测工具
  • 网站建设qq群百度小说官网
  • 有什么设计网站百度电话
  • doooor国外设计网站线上推广的方式
  • 微信小游戏开发软件河南seo推广
  • 网站数据分析怎么做宁德市属于哪个省
  • 广东东莞厚街买婬女seo实战培训班
  • 上海 外贸网站营销网页设计公司
  • 建设网站硬件百度网址查询
  • 沈阳网站专业世界企业排名500强
  • 网站建设费如何网上免费打广告
  • 图片演示dw做网站seo排名点击
  • 家谱网站怎么做怎么申请自己的网络平台
  • 网站开发诺亚科技b站2023年免费入口
  • 手机兼职赚钱郑州百度seo
  • 福田做网站公司长治seo顾问
  • 优化网站建设西安seo网站优化
  • 公司网站展示有哪些seo兼职平台
  • 昆山做网站价格seo网站优化策划书
  • wordpress还有什么seo优化方向
  • 鲁权屯网站建设网站开发制作培训学校
  • 石家庄集团公司网站建设指数基金是什么意思
  • 沈阳做网站的企业seo快排
  • openshift 做网站手机优化什么意思
  • 安卓市场2021最新版下载南昌seo
  • 开源的网站开发软件华联股份股票