MCPcopy
hub / github.com/Stability-AI/generative-models / conv_nd

Function conv_nd

sgm/modules/diffusionmodules/util.py:278–288  ·  view source on GitHub ↗

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

(dims, *args, **kwargs)

Source from the content-addressed store, hash-verified

276
277
278def conv_nd(dims, *args, **kwargs):
279 """
280 Create a 1D, 2D, or 3D convolution module.
281 """
282 if dims == 1:
283 return nn.Conv1d(*args, **kwargs)
284 elif dims == 2:
285 return nn.Conv2d(*args, **kwargs)
286 elif dims == 3:
287 return nn.Conv3d(*args, **kwargs)
288 raise ValueError(f"unsupported dimensions: {dims}")
289
290
291def linear(*args, **kwargs):

Callers 8

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected