MCPcopy Create free account
hub / github.com/LoSealL/VideoSuperResolution / _make_vector

Function _make_vector

VSR/Util/Utility.py:338–347  ·  view source on GitHub ↗

[B, H, W, C]->[B, H, W, c*k1*k2]

(x, patch=3, stride=1)

Source from the content-addressed store, hash-verified

336
337
338def _make_vector(x, patch=3, stride=1):
339 """[B, H, W, C]->[B, H, W, c*k1*k2]"""
340 k1, k2 = to_list(patch, 2)
341 h, w = tf.shape(x)[1], tf.shape(x)[2]
342 padded_x = tf.pad(x, [[0, 0], [k1 // 2] * 2, [k2 // 2] * 2, [0, 0]])
343 vec = []
344 for i in range(k1):
345 for j in range(k2):
346 vec.append(padded_x[:, i:i + h:stride, j:j + w:stride, :])
347 return tf.concat(vec, axis=-1)
348
349
350def _make_displacement(x, patch=3, max_dis=1, stride1=1, stride2=1):

Callers 2

test_make_vectorFunction · 0.90
correlationFunction · 0.85

Calls 2

to_listFunction · 0.85
shapeMethod · 0.45

Tested by 1

test_make_vectorFunction · 0.72