MCPcopy
hub / github.com/ali-vilab/AnyDoor / conv_nd

Function conv_nd

ldm/modules/diffusionmodules/util.py:221–231  ·  view source on GitHub ↗

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

(dims, *args, **kwargs)

Source from the content-addressed store, hash-verified

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

Callers 8

__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
make_zero_convMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected