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

Method __init__

src/diffusers/models/autoencoders/vae.py:843–877  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        out_channels: int,
        num_blocks: Tuple[int, ...],
        block_out_channels: Tuple[int, ...],
        act_fn: str,
    )

Source from the content-addressed store, hash-verified

841 """
842
843 def __init__(
844 self,
845 in_channels: int,
846 out_channels: int,
847 num_blocks: Tuple[int, ...],
848 block_out_channels: Tuple[int, ...],
849 act_fn: str,
850 ):
851 super().__init__()
852
853 layers = []
854 for i, num_block in enumerate(num_blocks):
855 num_channels = block_out_channels[i]
856
857 if i == 0:
858 layers.append(nn.Conv2d(in_channels, num_channels, kernel_size=3, padding=1))
859 else:
860 layers.append(
861 nn.Conv2d(
862 num_channels,
863 num_channels,
864 kernel_size=3,
865 padding=1,
866 stride=2,
867 bias=False,
868 )
869 )
870
871 for _ in range(num_block):
872 layers.append(AutoencoderTinyBlock(num_channels, num_channels, act_fn))
873
874 layers.append(nn.Conv2d(block_out_channels[-1], out_channels, kernel_size=3, padding=1))
875
876 self.layers = nn.Sequential(*layers)
877 self.gradient_checkpointing = False
878
879 def forward(self, x: torch.FloatTensor) -> torch.FloatTensor:
880 r"""The forward method of the `EncoderTiny` class."""

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45

Tested by

no test coverage detected