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

Method __init__

diffusers/src/diffusers/models/upsampling.py:42–61  ·  view source on GitHub ↗
(
        self,
        channels: int,
        use_conv: bool = False,
        use_conv_transpose: bool = False,
        out_channels: Optional[int] = None,
        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 use_conv_transpose: bool = False,
47 out_channels: Optional[int] = None,
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.use_conv_transpose = use_conv_transpose
55 self.name = name
56
57 self.conv = None
58 if use_conv_transpose:
59 self.conv = nn.ConvTranspose1d(channels, self.out_channels, 4, 2, 1)
60 elif use_conv:
61 self.conv = nn.Conv1d(self.channels, self.out_channels, 3, padding=1)
62
63 def forward(self, inputs: torch.Tensor) -> torch.Tensor:
64 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