AF3 AtomAttentionEncoder類解讀

AlphaFold3的AtomAttentionEncoder 類用于處理基于原子的表示學習任務。

源代碼:

class AtomAttentionEncoderOutput(NamedTuple):"""Structured output class for AtomAttentionEncoder."""token_single: torch.Tensor  # (bs, n_tokens, c_token)atom_single_skip_repr: torch.Tensor  # (bs, n_atoms, c_atom)atom_single_skip_proj: torch.Tensor  # (bs, n_atoms, c_atom)atom_pair_skip_repr: torch.Tensor  # (bs, n_atoms // n_queries, n_queries, n_keys, c_atompair)class AtomAttentionEncoder(nn.Module):def __init__(self,c_token: int,c_atom: int = 128,c_atompair: int = 16,c_trunk_pair: int = 16,no_blocks: int = 3,no_heads: int = 4,dropout=0.0,n_queries: int = 32,n_keys: int = 128,trunk_conditioning: bool = False,clear_cache_between_blocks: bool = False):"""Initialize the AtomAttentionEncoder module.Args:c_token:The number of channels for the token representation.c_atom:The number of channels for the atom representation. Defaults to 128.c_atompair:The number of channels for the pair representation. Defaults to 16.c_trunk_pair:The number of channels for the trunk pair representation. Defaults to 16.no_blocks:Number of blocks in AtomTransformer. Defaults to 3.no_heads:Number of parallel attention heads. Note that c_atom will be split across no_heads(i.e. each head will have dimension c_atom // no_heads).dropout:Dropout probability on attn_output_weights. Default: 0.0 (no dropout).n_queries:The size of the atom window. Defaults to 32.n_keys:Number of atoms each atom attends to in local sequence space. Defaults to 128.trunk_conditioning:Whether to condition the atom single and atom-pair representation on the trunk.Defaults to False.clear_cache_between_blocks:Whether to clear CUDA's GPU memory cache between blocks of thestack. Slows down each block but can reduce fragmentation"""super().__init__()self.no_blocks = no_blocksself.c_token = c_tokenself.c_atom = c_atomself.c_atompair = c_atompairself.c_trunk_pair = c_trunk_pairself.no_heads = no_headsself.dropout = dropoutself.n_queries = n_queriesself.n_keys = n_keysself.trunk_conditioning = trunk_conditioningself.clear_cache_between_blocks = clear_cache_between_blocks# Embedding per-atom metadata, concat(ref_pos, ref_charge, ref_mask, ref_element, ref_atom_name_chars)self.linear_atom_embedding = LinearNoBias(3 + 1 + 1 + 4 + 4, c_atom)  # 128, * 64# Embedding offsets between atom reference positionsself.linear_atom_offsets = LinearNoBias(3, c_atompair)self.linear_atom_distances = LinearNoBias(1, c_atompair)# Embedding the valid maskself.linear_mask = LinearNoBias(1, c_atompair)if trunk_conditioning:self.proj_trunk_single = nn.Sequential(LayerNorm(c_token),LinearNoBias(c_token, c_atom))self.proj_trunk_pair = nn.Sequential(LayerNorm(c_trunk_pair),LinearNoBias(c_trunk_pair, c_atompair))self.linear_noisy_pos = LinearNoBias(3, c_atom)# Adding the single conditioning to the pair representationself.linear_single_to_pair_row = LinearNoBias(c_atom, c_atompair, init='relu')self.linear_single_to_pair_col = LinearNoBias(c_atom, c_atompair, init='relu')# Small MLP on the pair activationsself.pair_mlp = nn

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/65103.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/65103.shtml
英文地址,請注明出處:http://en.pswp.cn/web/65103.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【51單片機零基礎-chapter3:按鍵:獨立按鍵|||附帶常見C語句.邏輯運算符】

將unsigned char var0;看作溝通二進制和十進制的橋梁 var是8位,初始為0000 0000; 同時可以進行十進制的運算 邏輯運算 位運算 & 按位與(有0則0) | 按位或(有1則1) ~ 按位非 ^ 按位異或(相同則1,不同為0) <<按位左移 >>按位右移 位運算符解釋: 0011 1100 <&…

游戲如何檢測iOS越獄

不同于安卓的開源生態&#xff0c;iOS一直秉承著安全性更高的閉源生態&#xff0c;系統中的硬件、軟件和服務會經過嚴格審核和測試&#xff0c;來保障安全性與穩定性。 據FairGurd觀察&#xff0c;雖然iOS系統具備一定的安全性&#xff0c;但并非沒有漏洞&#xff0c;如市面上…

在Lua中,Metatable元表如何操作?

Lua中的Metatable&#xff08;元表&#xff09;是一個強大的特性&#xff0c;它允許我們改變表&#xff08;table&#xff09;的行為。下面是對Lua中的Metatable元表的詳細介紹&#xff0c;包括語法規則和示例。 1.Metatable介紹 Metatable是一個普通的Lua表&#xff0c;它用于…

Python基于matplotlib實現樹形圖的繪制

在Python中&#xff0c;你可以使用matplotlib庫來繪制樹形圖&#xff08;Tree Diagram&#xff09;。雖然matplotlib本身沒有專門的樹形圖繪制函數&#xff0c;但你可以通過組合不同的圖形元素&#xff08;如線條和文本&#xff09;來實現這一點。 以下是一個簡單的示例&#…

2 秒殺系統架構

第一步 思考面臨的問題和業務場景 秒殺系統面臨的問題: 短時間內并發非常高&#xff0c;如果按照秒殺的并發做相應的承載會造成大量資源的浪費。第二解決超賣的問題。 第二步 思考目前的處境和解決方案 因為秒殺系統屬于短時間內的高并發問題&#xff0c;我們不可能使用那么…

12306分流搶票軟件 bypass v1.16.43 綠色版(春節自動搶票工具)

軟件介紹 12306Bypass分流搶票軟件&#xff0c;易操作強大的12306搶票軟件&#xff0c;全程自動搶票&#xff0c;云識別驗證碼打碼&#xff0c;多線程秒單、穩定撿漏&#xff0c;支持搶候補票、搶到票自動付款&#xff0c;支持多天、多車次、多席別、多乘客、短信提醒等功能。…

淺談torch.utils.data.TensorDataset和torch.utils.data.DataLoader

1.torch.utils.data.TensorDataset 功能定位 torch.utils.data.TensorDataset 是一個將多個張量&#xff08;Tensor&#xff09;數據進行簡單包裝整合的數據集類&#xff0c;它主要的作用是將相關聯的數據&#xff08;比如特征數據和對應的標簽數據等&#xff09;組合在一起&…

【Go】運行自己的第一個Go程序

運行自己的第一個Go程序 一、Go語言的安裝Go環境安裝查看是否安裝成功配置GOPROXY(代理) 二、Goland安裝三、Goland破解四、新建項目 開一篇專欄記錄學習Go的過程&#xff0c;一門新語言從hello world開始&#xff0c;這篇文章詳細講解Go語言環境搭建及hello world實現 一、Go語…

計算機的錯誤計算(二百零一)

摘要 用兩個大模型計算 &#xff0c;結果保留 10位有效數字。實驗表明&#xff0c;兩個大模型的輸出均只有1位正確數字&#xff1b;并它們幾乎相同&#xff1a;僅最后1位數字不同。 例1. 計算 , 結果保留 10位有效數字。 下面是與一個數學解題器的對話。 以上為與一個數學解…

下載excel

1.引入依賴 <dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>5.2.5</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-oo…

2024 年度時序數據庫 IoTDB 論文總結

論文成果總結 2024 年度&#xff0c;時序數據庫 IoTDB 在數據庫領域 CCF-A 類國際會議上共發表論文 8 篇&#xff0c;包括&#xff1a;SIGMOD 3 篇、VLDB 3 篇、ICDE 2 篇&#xff0c;涵蓋存儲、引擎、查詢、分析等方面。 2024 最后一天&#xff0c;我們將分類盤點 IoTDB 本年的…

ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32‘ not found

這個問題之前遇到過&#xff0c;沒有記錄&#xff0c;導致今天又花了2小時 原因是沒有GLIBC——2.32 使用以下命令查一下有哪些版本&#xff1a; strings /lib/x86_64-linux-gnu/libm.so.6 | grep GLIBC_ 我已經安裝好了&#xff0c;所有有2.32版本 原因是當前的ubuntu版本…

海南省大數據發展中心:數據資產場景化評估案例手冊(第二期)

2025年1月3日&#xff0c;海南省數據產品超市印發《數據資產場景化評估案例手冊&#xff08;第二期&#xff09;》&#xff08;以下簡稱《手冊》&#xff09;&#xff0c;該手冊是基于真實數據要素典型應用場景進行數據資產評估操作的指導性手冊&#xff0c;為企業在數據資產入…

python3GUI--智慧交通監控與管理系統 By:PyQt5

文章目錄 一&#xff0e;前言二&#xff0e;預覽三&#xff0e;軟件組成&技術難點1.軟件組成結構2.技術難點3.項目結構 四&#xff0e;總結 大小&#xff1a;35.5 M&#xff0c;軟件安裝包放在了這里! 一&#xff0e;前言 博主高產&#xff0c;本次給大家帶來一款我自己使…

Linux高并發服務器開發 第八天(makefile的規則 wildcard/patsubst函數 普通變量/自動變量/其他關鍵字)

目錄 1.makefile 1.1makefile的規則 1.2兩個函數 1.3三個自動變量 1.3.1普通變量 (自定義變量) 1.3.2自動變量 1.3.3其他關鍵字 - ALL/all - clean 1.makefile - 作用&#xff1a;進行項目管理。 - 初步學習&#xff1a;1個規則、2個函數、3個自動變量。 - 要想使用默…

Vue動態控制disabled屬性

參考:https://blog.csdn.net/guhanfengdu/article/details/126082781 在Vue中disabled:的值是受布爾值影響的&#xff0c;false為關閉禁用&#xff0c;true為開啟禁用效果。 結果就是true會讓按鈕禁用 相反false會讓按鈕重新可以使用 那如果想要通過id屬性值來判斷是否禁用…

【DevOps】Jenkins項目發布

Jenkins項目發布 文章目錄 Jenkins項目發布前言資源列表基礎環境一、Jenkins發布靜態網站1.1、項目介紹1.2、部署Web1.3、準備gitlab1.4、配置gitlab1.5、創建項目1.6、推送代碼 二、Jenkins中創建gitlab憑據2.1、創建憑據2.2、在Jenkins中添加遠程主機2.3、獲取gitlab項目的UR…

每日一學——自動化工具(Jenkins)

3.2 Jenkins 3.2.1 CI/CD流程設計 嘿&#xff0c;小伙伴們&#xff01;今天我們來聊聊Jenkins——這個在持續集成&#xff08;CI&#xff09;和持續部署&#xff08;CD&#xff09;領域里大名鼎鼎的工具。Jenkins不僅可以幫我們自動化構建和測試代碼&#xff0c;還能自動部署…

Vue2/Vue3使用DataV

Vue2 注意vue2與3安裝DataV命令命令是不同的Vue3 DataV - Vue3 官網地址 注意vue2與3安裝DataV命令命令是不同的 vue3vite 與 Vue3webpack 對應安裝也不同vue3vite npm install kjgl77/datav-vue3全局引入 // main.ts中全局引入 import { createApp } from vue import Da…

【AI學習】Transformer深入學習(二):從MHA、MQA、GQA到MLA

前面文章&#xff1a; 《Transformer深入學習&#xff08;一&#xff09;&#xff1a;Sinusoidal位置編碼的精妙》 一、MHA、MQA、GQA 為了降低KV cache&#xff0c;MQA、GQA作為MHA的變體&#xff0c;很容易理解。 多頭注意力&#xff08;MHA&#xff09;&#xff1a; 多頭注…