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

Function upsample

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

Source from the content-addressed store, hash-verified

13
14
15def upsample(x, *, name, with_conv):
16 with tf.variable_scope(name):
17 B, H, W, C = x.shape
18 x = tf.image.resize(x, size=[H * 2, W * 2], method=tf.image.ResizeMethod.NEAREST_NEIGHBOR, align_corners=True)
19 assert x.shape == [B, H * 2, W * 2, C]
20 if with_conv:
21 x = nn.conv2d(x, name='conv', num_units=C, filter_size=3, stride=1)
22 assert x.shape == [B, H * 2, W * 2, C]
23 return x
24
25
26def downsample(x, *, name, with_conv):

Callers 1

modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected