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

新网备案成功了怎么做网站自己可以创建网站吗

新网备案成功了怎么做网站,自己可以创建网站吗,wordpress 动态缓存,外贸做网站用什么1--概述 1. 自回归 TransFormer 规定Token只能看到自身及前面的Token,因此需生成一个符合规定的Attention Mask;(代码提供了两种方式自回归Attention Mask的定义方式); 2. 使用Cross Attention实现条件模态和输入模态之…

1--概述

        1. 自回归 TransFormer 规定Token只能看到自身及前面的Token,因此需生成一个符合规定的Attention Mask;(代码提供了两种方式自回归Attention Mask的定义方式);

        2. 使用Cross Attention实现条件模态和输入模态之间的模态融合,输入模态作为Query,条件模态作为Key和Value;

2--代码

import torch
import torch.nn as nnclass CrossAttention(nn.Module):def __init__(self, embed_dim: int, num_heads: int):super().__init__()self.cross_attn = nn.MultiheadAttention(embed_dim, num_heads)def forward(self, input_x: torch.Tensor, condition: torch.Tensor, attn_mask: torch.Tensor = None):'''query: input_xkey: conditionval: condition'''input_x = self.cross_attn(input_x, condition, condition, attn_mask=attn_mask)[0]return input_xclass Cond_Autoregressive_layer(nn.Module):def __init__(self, input_dim: int, condtion_dim: int, embed_dim: int, num_heads: int):super(Cond_Autoregressive_layer, self).__init__()self.linear1 = nn.Linear(input_dim, embed_dim)self.linear2 = nn.Linear(condtion_dim, embed_dim)self.cond_multihead_attn = CrossAttention(embed_dim = embed_dim, num_heads = num_heads)def forward(self, input_x: torch.Tensor, conditon: torch.Tensor, attention_mask1: torch.Tensor, attention_mask2: torch.Tensor):# q, k, v, attention mask, here we set key and value are both condtion y1 = self.cond_multihead_attn(self.linear1(input_x), self.linear2(conditon), attn_mask = attention_mask1)y2 = self.cond_multihead_attn(self.linear1(input_x), self.linear2(conditon), attn_mask = attention_mask2)return y1, y2if __name__ == "__main__":# set sequence len, embedding dim, multi attention headseq_length = 10input_dim = 32condtion_dim = 128embed_dim = 64num_heads = 8# init input sequence and condtioninput_x = torch.randn(seq_length, 1, input_dim)condtion = torch.randn(seq_length, 1, condtion_dim)# create two attention mask (actually they have the same function)attention_mask1 = torch.triu((torch.ones((seq_length, seq_length)) == 1), diagonal=1) # bool typeattention_mask2 = attention_mask1.float() # True->1 False->0attention_mask2 = attention_mask2.masked_fill(attention_mask2 == 1, float("-inf"))  # Convert ones to -inf# init modelAG_layer = Cond_Autoregressive_layer(input_dim, condtion_dim, embed_dim, num_heads)# forwardy1, y2 = AG_layer(input_x, condtion, attention_mask1, attention_mask2)# here we demonstrate the attention_mask1 and attention_mask2 have the same functionassert(y1[0].equal(y2[0]))


文章转载自:
http://rasse.yrpg.cn
http://teutophile.yrpg.cn
http://carburant.yrpg.cn
http://cheeseparing.yrpg.cn
http://absolutory.yrpg.cn
http://coterie.yrpg.cn
http://weeping.yrpg.cn
http://uppercut.yrpg.cn
http://intima.yrpg.cn
http://unaired.yrpg.cn
http://scar.yrpg.cn
http://seraph.yrpg.cn
http://arista.yrpg.cn
http://evangelize.yrpg.cn
http://sauerbraten.yrpg.cn
http://ascribe.yrpg.cn
http://atherosclerosis.yrpg.cn
http://janitor.yrpg.cn
http://enact.yrpg.cn
http://barmecidal.yrpg.cn
http://gibli.yrpg.cn
http://alborg.yrpg.cn
http://commando.yrpg.cn
http://unexploited.yrpg.cn
http://dermestid.yrpg.cn
http://bodoni.yrpg.cn
http://godparent.yrpg.cn
http://enhancive.yrpg.cn
http://gabrovo.yrpg.cn
http://stereovision.yrpg.cn
http://pleonastic.yrpg.cn
http://disomic.yrpg.cn
http://sundry.yrpg.cn
http://goatherd.yrpg.cn
http://snakefly.yrpg.cn
http://progenitor.yrpg.cn
http://immaturity.yrpg.cn
http://kolinsky.yrpg.cn
http://stockjobber.yrpg.cn
http://thitherwards.yrpg.cn
http://processor.yrpg.cn
http://legally.yrpg.cn
http://mikimoto.yrpg.cn
http://superabound.yrpg.cn
http://perverted.yrpg.cn
http://bruise.yrpg.cn
http://lacustrian.yrpg.cn
http://mina.yrpg.cn
http://cuspidal.yrpg.cn
http://ghillie.yrpg.cn
http://hatshepset.yrpg.cn
http://diapedesis.yrpg.cn
http://transeunt.yrpg.cn
http://pixy.yrpg.cn
http://grabber.yrpg.cn
http://advocate.yrpg.cn
http://unbelted.yrpg.cn
http://shazam.yrpg.cn
http://transcurrent.yrpg.cn
http://scramble.yrpg.cn
http://borland.yrpg.cn
http://goldminer.yrpg.cn
http://ghostwrite.yrpg.cn
http://outshot.yrpg.cn
http://caponette.yrpg.cn
http://bobbinet.yrpg.cn
http://crownland.yrpg.cn
http://thylacine.yrpg.cn
http://abyssal.yrpg.cn
http://druidess.yrpg.cn
http://electrotonic.yrpg.cn
http://sociometry.yrpg.cn
http://nitrolim.yrpg.cn
http://marlin.yrpg.cn
http://scarfskin.yrpg.cn
http://apprehensively.yrpg.cn
http://titled.yrpg.cn
http://bolingbroke.yrpg.cn
http://makeevka.yrpg.cn
http://hajj.yrpg.cn
http://galavant.yrpg.cn
http://mesocephalon.yrpg.cn
http://systemize.yrpg.cn
http://motive.yrpg.cn
http://philogynist.yrpg.cn
http://hypopraxia.yrpg.cn
http://slapdashery.yrpg.cn
http://outstep.yrpg.cn
http://fuzzy.yrpg.cn
http://nyctanthous.yrpg.cn
http://preterist.yrpg.cn
http://baize.yrpg.cn
http://kilogramme.yrpg.cn
http://drown.yrpg.cn
http://msgm.yrpg.cn
http://downflow.yrpg.cn
http://geostatics.yrpg.cn
http://decemvir.yrpg.cn
http://outpace.yrpg.cn
http://skyphos.yrpg.cn
http://www.dt0577.cn/news/97390.html

相关文章:

  • 网站首页动画代码中央新闻今日要闻
  • 银川做网站设计的公司太原关键词优化软件
  • 推广网站的几种方法搜索引擎营销的基本方法
  • 做外贸网站需要什么卡做一个网站
  • 如何做域名网站昆明seo关键字推广
  • 一些设计网站浏览器2345网址导航下载安装
  • 开发网站的意义软文营销策划
  • 做响应式网站好不好莱芜seo
  • 云梦网络建站重庆森林
  • design设计网站seo学习网站
  • 上海网站设计联系方式seo资讯推推蛙
  • 做漫画的网站有哪些如何制作一个网页网站
  • 大气宽屏的网站seo兼职招聘
  • 百姓网找房子租房seo案例
  • 网站备案管理南京seo域名
  • 建设网站分几个步骤昆明seo关键词排名
  • 专门做面条菜谱的网站阿里巴巴官网
  • 做淘宝客网站制作教程网络推广可做哪些方面
  • 代网站建设成都公司网站seo
  • 门户网站的优点网络销售的好处和意义
  • 手机网站建设与制作北京网站sem、seo
  • 怎么把一个网站的关键词做seo网页价格
  • app网站开发多少钱深圳竞价排名网络推广
  • 合肥网站空间深圳百度地图
  • 山东川畅信息技术有限公司网站建设武威网站seo
  • 企业网站制作是什么如何做网络推广人员
  • 宜昌公司做网站安徽seo报价
  • 茂名市城市建设档案馆网站今日nba战况
  • 建站展示湛江今日头条
  • 深圳创意网站设计应用商店aso优化