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

Method __init__

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

Source from the content-addressed store, hash-verified

36
37class EncoderBlock(nn.Module):
38 def __init__(self, embed_dim, n_heads, dropout):
39 super(EncoderBlock, self).__init__()
40 self.attention = nn.MultiheadAttention(embed_dim, n_heads, dropout=dropout)
41 self.ln1 = nn.LayerNorm(embed_dim)
42 self.ff = nn.Sequential(
43 nn.Linear(embed_dim, 4 * embed_dim),
44 nn.ReLU(),
45 nn.Linear(4 * embed_dim, embed_dim),
46 nn.Dropout(dropout)
47 )
48 self.ln2 = nn.LayerNorm(embed_dim)
49
50 def forward(self, x, src_mask=None):
51 attn_output, _ = self.attention(x, x, x, attn_mask=src_mask)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected