AF3 AtomAttentionDecoder类源码解读

打印 上一主题 下一主题

主题 1496|帖子 1496|积分 4488

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
AlphaFold3的AtomAttentionDecoder类旨在从每个 token 的表示扩展到每个原子的表示,同时通过交错注意力机制对原子及其对关系举行建模。这种设计可以在生物分子建模中捕获复杂的原子级别交互。
源代码:

  1. class AtomAttentionDecoder(nn.Module):
  2.     """AtomAttentionDecoder that broadcasts per-token activations to per-atom activations."""
  3.     def __init__(
  4.             self,
  5.             c_token: int,
  6.             c_atom: int = 128,
  7.             c_atompair: int = 16,
  8.             no_blocks: int = 3,
  9.             no_heads: int = 8,
  10.             dropout=0.0,
  11.             n_queries: int = 32,
  12.             n_keys: int = 128,
  13.             clear_cache_between_blocks: bool = False
  14.     ):
  15.         """Initialize the AtomAttentionDecoder module.
  16.         Args:
  17.             c_token:
  18.                 The number of channels for the token representation.
  19.             c_atom:
  20.                 The number of channels for the atom representation. Defaults to 128.
  21.             c_atompair:
  22.                 The number of channels for the atom pair representation. Defaults to 16.
  23.             no_blocks:
  24.                 Number of blocks.
  25.             no_heads:
  26.                 Number of parallel attention heads. Note that c_atom will be split across no_heads
  27.                 (i.e. each head will have dimension c_atom // no_heads).
  28.             dropout:
  29.                 Dropout probability on attn_output_weights. Default: 0.0 (no dropout).
  30.             n_queries:
  31.                 The size of the atom window. Defaults to 32.
  32.             n_keys:
  33.                 Number of atoms each atom attends to in local sequence space. Defaults to 128.
  34.             clear_cache_between_blocks:
  35.                 Whether to clear CUDA's GPU memory cache between blocks of the
  36.                 stack. Slows down each block but can reduce fragmentation
  37.         """
  38.         super().__init__()
  39.         self.c_token = c_token
  40.         self.c_atom = c_atom
  41.         self.c_atompair = c_atompair
  42.         self.num_blocks = no_blocks
  43.         self.num_heads = no_heads
  44.         self.dropout = dropout
  45.         self.n_queries = n_queries
  46.         self.n_keys = n_keys
  47.         self.clear_cache_bet
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

梦见你的名字

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表