MCPcopy Create free account
hub / github.com/ShengbenBi/CTSAC / __init__

Method __init__

SAC-robot-navigation-CL/SAC/SAC.py:68–80  ·  view source on GitHub ↗
(self, embed_dim, n_heads, dropout)

Source from the content-addressed store, hash-verified

66
67class DecoderBlock(nn.Module):
68 def __init__(self, embed_dim, n_heads, dropout):
69 super(DecoderBlock, self).__init__()
70 self.self_attention = nn.MultiheadAttention(embed_dim, n_heads, dropout=dropout)
71 self.ln1 = nn.LayerNorm(embed_dim)
72 self.enc_dec_attention = nn.MultiheadAttention(embed_dim, n_heads, dropout=dropout)
73 self.ln2 = nn.LayerNorm(embed_dim)
74 self.ff = nn.Sequential(
75 nn.Linear(embed_dim, 4 * embed_dim),
76 nn.ReLU(),
77 nn.Linear(4 * embed_dim, embed_dim),
78 nn.Dropout(dropout)
79 )
80 self.ln3 = nn.LayerNorm(embed_dim)
81
82 def forward(self, x, enc_output, tgt_mask=None, memory_mask=None):
83 self_attn_output, _ = self.self_attention(x, x, x, attn_mask=tgt_mask)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected