MCPcopy Index your code
hub / github.com/hojonathanho/diffusion / downsample

Function downsample

diffusion_tf/models/unet.py:26–34  ·  view source on GitHub ↗
(x, *, name, with_conv)

Source from the content-addressed store, hash-verified

24
25
26def downsample(x, *, name, with_conv):
27 with tf.variable_scope(name):
28 B, H, W, C = x.shape
29 if with_conv:
30 x = nn.conv2d(x, name='conv', num_units=C, filter_size=3, stride=2)
31 else:
32 x = tf.nn.avg_pool(x, 2, 2, 'SAME')
33 assert x.shape == [B, H // 2, W // 2, C]
34 return x
35
36
37def resnet_block(x, *, temb, name, out_ch=None, conv_shortcut=False, dropout):

Callers 1

modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected