MCPcopy Create free account
hub / github.com/huggingface/diffusers / OutValueFunctionBlock

Class OutValueFunctionBlock

src/diffusers/models/unets/unet_1d_blocks.py:242–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240
241
242class 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 = {

Callers 1

get_out_blockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…