MCPcopy Create free account
hub / github.com/Newmu/dcgan_code / patch

Function patch

lib/data_utils.py:14–21  ·  view source on GitHub ↗
(x, ph, pw=None)

Source from the content-addressed store, hash-verified

12 return x[j:j+ph, i:i+pw]
13
14def patch(x, ph, pw=None):
15 if pw is None:
16 pw = ph
17 h, w = x.shape[:2]
18 j = py_rng.randint(0, h-ph)
19 i = py_rng.randint(0, w-pw)
20 x = x[j:j+ph, i:i+pw]
21 return x
22
23def list_shuffle(*data):
24 idxs = np_rng.permutation(np.arange(len(data[0])))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected