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

Method __init__

src/diffusers/models/downsampling.py:43–63  ·  view source on GitHub ↗
(
        self,
        channels: int,
        use_conv: bool = False,
        out_channels: Optional[int] = None,
        padding: int = 1,
        name: str = "conv",
    )

Source from the content-addressed store, hash-verified

41 """
42
43 def __init__(
44 self,
45 channels: int,
46 use_conv: bool = False,
47 out_channels: Optional[int] = None,
48 padding: int = 1,
49 name: str = "conv",
50 ):
51 super().__init__()
52 self.channels = channels
53 self.out_channels = out_channels or channels
54 self.use_conv = use_conv
55 self.padding = padding
56 stride = 2
57 self.name = name
58
59 if use_conv:
60 self.conv = nn.Conv1d(self.channels, self.out_channels, 3, stride=stride, padding=padding)
61 else:
62 assert self.channels == self.out_channels
63 self.conv = nn.AvgPool1d(kernel_size=stride, stride=stride)
64
65 def forward(self, inputs: torch.Tensor) -> torch.Tensor:
66 assert inputs.shape[1] == self.channels

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected