MCPcopy Create free account
hub / github.com/TeleHuman/PBHC / _build_mlp_layer

Method _build_mlp_layer

humanoidverse/agents/modules/modules.py:47–63  ·  view source on GitHub ↗
(self, layer_config)

Source from the content-addressed store, hash-verified

45 raise NotImplementedError(f"Unsupported layer type: {layer_config['type']}")
46
47 def _build_mlp_layer(self, layer_config):
48 layers = []
49 hidden_dims = layer_config['hidden_dims']
50 output_dim = self.output_dim
51 activation = getattr(nn, layer_config['activation'])()
52
53 layers.append(nn.Linear(self.input_dim, hidden_dims[0]))
54 layers.append(activation)
55
56 for l in range(len(hidden_dims)):
57 if l == len(hidden_dims) - 1:
58 layers.append(nn.Linear(hidden_dims[l], output_dim))
59 else:
60 layers.append(nn.Linear(hidden_dims[l], hidden_dims[l + 1]))
61 layers.append(activation)
62
63 self.module = nn.Sequential(*layers)
64
65 def forward(self, input):
66 return self.module(input)

Callers 1

_build_network_layerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected