MCPcopy
hub / github.com/openai/improved-diffusion / conv_nd

Function conv_nd

improved_diffusion/nn.py:22–32  ·  view source on GitHub ↗

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

(dims, *args, **kwargs)

Source from the content-addressed store, hash-verified

20
21
22def conv_nd(dims, *args, **kwargs):
23 """
24 Create a 1D, 2D, or 3D convolution module.
25 """
26 if dims == 1:
27 return nn.Conv1d(*args, **kwargs)
28 elif dims == 2:
29 return nn.Conv2d(*args, **kwargs)
30 elif dims == 3:
31 return nn.Conv3d(*args, **kwargs)
32 raise ValueError(f"unsupported dimensions: {dims}")
33
34
35def linear(*args, **kwargs):

Callers 5

__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