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

Method __init__

src/diffusers/models/resnet.py:657–688  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        out_channels: int | None = None,
        temb_channels: int = 512,
        eps: float = 1e-6,
        temporal_eps: float | None = 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

655 """
656
657 def __init__(
658 self,
659 in_channels: int,
660 out_channels: int | None = None,
661 temb_channels: int = 512,
662 eps: float = 1e-6,
663 temporal_eps: float | None = None,
664 merge_factor: float = 0.5,
665 merge_strategy="learned_with_images",
666 switch_spatial_to_temporal_mix: bool = False,
667 ):
668 super().__init__()
669
670 self.spatial_res_block = ResnetBlock2D(
671 in_channels=in_channels,
672 out_channels=out_channels,
673 temb_channels=temb_channels,
674 eps=eps,
675 )
676
677 self.temporal_res_block = TemporalResnetBlock(
678 in_channels=out_channels if out_channels is not None else in_channels,
679 out_channels=out_channels if out_channels is not None else in_channels,
680 temb_channels=temb_channels,
681 eps=temporal_eps if temporal_eps is not None else eps,
682 )
683
684 self.time_mixer = AlphaBlender(
685 alpha=merge_factor,
686 merge_strategy=merge_strategy,
687 switch_spatial_to_temporal_mix=switch_spatial_to_temporal_mix,
688 )
689
690 def forward(
691 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