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

Method __init__

improved_diffusion/unet.py:91–100  ·  view source on GitHub ↗
(self, channels, use_conv, dims=2)

Source from the content-addressed store, hash-verified

89 """
90
91 def __init__(self, channels, use_conv, dims=2):
92 super().__init__()
93 self.channels = channels
94 self.use_conv = use_conv
95 self.dims = dims
96 stride = 2 if dims != 3 else (1, 2, 2)
97 if use_conv:
98 self.op = conv_nd(dims, channels, channels, 3, stride=stride, padding=1)
99 else:
100 self.op = avg_pool_nd(stride)
101
102 def forward(self, x):
103 assert x.shape[1] == self.channels

Callers

nothing calls this directly

Calls 3

conv_ndFunction · 0.85
avg_pool_ndFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected