| 240 | |
| 241 | |
| 242 | class OutValueFunctionBlock(nn.Module): |
| 243 | def __init__(self, fc_dim: int, embed_dim: int, act_fn: str = "mish"): |
| 244 | super().__init__() |
| 245 | self.final_block = nn.ModuleList( |
| 246 | [ |
| 247 | nn.Linear(fc_dim + embed_dim, fc_dim // 2), |
| 248 | get_activation(act_fn), |
| 249 | nn.Linear(fc_dim // 2, 1), |
| 250 | ] |
| 251 | ) |
| 252 | |
| 253 | def forward(self, hidden_states: torch.Tensor, temb: torch.Tensor) -> torch.Tensor: |
| 254 | hidden_states = hidden_states.view(hidden_states.shape[0], -1) |
| 255 | hidden_states = torch.cat((hidden_states, temb), dim=-1) |
| 256 | for layer in self.final_block: |
| 257 | hidden_states = layer(hidden_states) |
| 258 | |
| 259 | return hidden_states |
| 260 | |
| 261 | |
| 262 | _kernels = { |
no outgoing calls
no test coverage detected
searching dependent graphs…