MCPcopy Create free account
hub / github.com/IceClear/StableSR / __init__

Method __init__

ldm/modules/diffusionmodules/openaimodel.py:198–211  ·  view source on GitHub ↗
(self, channels, use_conv, dims=2, out_channels=None,padding=1)

Source from the content-addressed store, hash-verified

196 """
197
198 def __init__(self, channels, use_conv, dims=2, out_channels=None,padding=1):
199 super().__init__()
200 self.channels = channels
201 self.out_channels = out_channels or channels
202 self.use_conv = use_conv
203 self.dims = dims
204 stride = 2 if dims != 3 else (1, 2, 2)
205 if use_conv:
206 self.op = conv_nd(
207 dims, self.channels, self.out_channels, 3, stride=stride, padding=padding
208 )
209 else:
210 assert self.channels == self.out_channels
211 self.op = avg_pool_nd(dims, kernel_size=stride, stride=stride)
212
213 def forward(self, x):
214 assert x.shape[1] == self.channels

Callers

nothing calls this directly

Calls 3

conv_ndFunction · 0.90
avg_pool_ndFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected