MCPcopy Create free account
hub / github.com/Rex-sys-hk/PlanScope / __init__

Method __init__

src/models/pluto/modules/planning_decoder.py:90–133  ·  view source on GitHub ↗
(
        self,
        num_mode,
        decoder_depth,
        dim,
        num_heads,
        mlp_ratio,
        dropout,
        future_steps,
        yaw_constraint=False,
        cat_x=False,
    )

Source from the content-addressed store, hash-verified

88
89class PlanningDecoder(nn.Module):
90 def __init__(
91 self,
92 num_mode,
93 decoder_depth,
94 dim,
95 num_heads,
96 mlp_ratio,
97 dropout,
98 future_steps,
99 yaw_constraint=False,
100 cat_x=False,
101 ) -> None:
102 super().__init__()
103
104 self.num_mode = num_mode
105 self.future_steps = future_steps
106 self.yaw_constraint = yaw_constraint
107 self.cat_x = cat_x
108
109 self.decoder_blocks = nn.ModuleList(
110 [
111 DecoderLayer(dim, num_heads, mlp_ratio, dropout)
112 for _ in range(decoder_depth)
113 ]
114 )
115
116 self.r_pos_emb = FourierEmbedding(3, dim, 64)
117 self.r_encoder = PointsEncoder(6, dim)
118
119 self.q_proj = nn.Linear(2 * dim, dim)
120
121 self.m_emb = nn.Parameter(torch.Tensor(1, 1, num_mode, dim))
122 self.m_pos = nn.Parameter(torch.Tensor(1, num_mode, dim))
123
124 if self.cat_x:
125 self.cat_x_proj = nn.Linear(2 * dim, dim)
126
127 self.loc_head = MLPLayer(dim, 2 * dim, self.future_steps * 2)
128 self.yaw_head = MLPLayer(dim, 2 * dim, self.future_steps * 2)
129 self.vel_head = MLPLayer(dim, 2 * dim, self.future_steps * 2)
130 self.pi_head = MLPLayer(dim, dim, 1)
131
132 nn.init.normal_(self.m_emb, mean=0.0, std=0.01)
133 nn.init.normal_(self.m_pos, mean=0.0, std=0.01)
134
135 def forward(self, data, enc_data):
136 enc_emb = enc_data["enc_emb"]

Callers

nothing calls this directly

Calls 5

FourierEmbeddingClass · 0.85
PointsEncoderClass · 0.85
MLPLayerClass · 0.85
DecoderLayerClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected