MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / __init__

Method __init__

diffusers/src/diffusers/models/downsampling.py:42–62  ·  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

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

Callers 4

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected