MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / rearrange

Function rearrange

cnn_class/cnn_tf.py:39–48  ·  view source on GitHub ↗
(X)

Source from the content-addressed store, hash-verified

37
38
39def rearrange(X):
40 # input is (32, 32, 3, N)
41 # output is (N, 32, 32, 3)
42 # N = X.shape[-1]
43 # out = np.zeros((N, 32, 32, 3), dtype=np.float32)
44 # for i in xrange(N):
45 # for j in xrange(3):
46 # out[i, :, :, j] = X[:, :, j, i]
47 # return out / 255
48 return (X.transpose(3, 0, 1, 2) / 255).astype(np.float32)
49
50
51def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected