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

Function conv_nd

ldm/modules/diffusionmodules/util.py:218–228  ·  view source on GitHub ↗

Create a 1D, 2D, or 3D convolution module.

(dims, *args, **kwargs)

Source from the content-addressed store, hash-verified

216 return super().forward(x.float()).type(x.dtype)
217
218def conv_nd(dims, *args, **kwargs):
219 """
220 Create a 1D, 2D, or 3D convolution module.
221 """
222 if dims == 1:
223 return nn.Conv1d(*args, **kwargs)
224 elif dims == 2:
225 return nn.Conv2d(*args, **kwargs)
226 elif dims == 3:
227 return nn.Conv3d(*args, **kwargs)
228 raise ValueError(f"unsupported dimensions: {dims}")
229
230
231def linear(*args, **kwargs):

Callers 9

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected