MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / __init__

Method __init__

src/diffusers/models/resnet.py:685–716  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        out_channels: Optional[int] = None,
        temb_channels: int = 512,
        eps: float = 1e-6,
        temporal_eps: Optional[float] = None,
        merge_factor: float = 0.5,
        merge_strategy="learned_with_images",
        switch_spatial_to_temporal_mix: bool = False,
    )

Source from the content-addressed store, hash-verified

683 """
684
685 def __init__(
686 self,
687 in_channels: int,
688 out_channels: Optional[int] = None,
689 temb_channels: int = 512,
690 eps: float = 1e-6,
691 temporal_eps: Optional[float] = None,
692 merge_factor: float = 0.5,
693 merge_strategy="learned_with_images",
694 switch_spatial_to_temporal_mix: bool = False,
695 ):
696 super().__init__()
697
698 self.spatial_res_block = ResnetBlock2D(
699 in_channels=in_channels,
700 out_channels=out_channels,
701 temb_channels=temb_channels,
702 eps=eps,
703 )
704
705 self.temporal_res_block = TemporalResnetBlock(
706 in_channels=out_channels if out_channels is not None else in_channels,
707 out_channels=out_channels if out_channels is not None else in_channels,
708 temb_channels=temb_channels,
709 eps=temporal_eps if temporal_eps is not None else eps,
710 )
711
712 self.time_mixer = AlphaBlender(
713 alpha=merge_factor,
714 merge_strategy=merge_strategy,
715 switch_spatial_to_temporal_mix=switch_spatial_to_temporal_mix,
716 )
717
718 def forward(
719 self,

Callers

nothing calls this directly

Calls 4

ResnetBlock2DClass · 0.85
TemporalResnetBlockClass · 0.85
AlphaBlenderClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected