MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / rearrange

Function rearrange

cnn_class/keras_example.py:31–40  ·  view source on GitHub ↗
(X)

Source from the content-addressed store, hash-verified

29# return I
30
31def rearrange(X):
32 # input is (32, 32, 3, N)
33 # output is (N, 32, 32, 3)
34 # N = X.shape[-1]
35 # out = np.zeros((N, 32, 32, 3), dtype=np.float32)
36 # for i in xrange(N):
37 # for j in xrange(3):
38 # out[i, :, :, j] = X[:, :, j, i]
39 # return out / 255
40 return (X.transpose(3, 0, 1, 2) / 255.).astype(np.float32)
41
42
43# get the data

Callers 1

keras_example.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected