title: CNN: Why is the image matrix transformed to (channel, width, height)?
body: <p>I am going through some CNN articles. I see that they transform the input image to <code>(channel, width, height)</code>.</p>
  
  <p>A code example taken from <a href="http://gluon.mxnet.io/chapter04_convolutional-neural-networks/cnn-scratch.html" rel="nofollow noreferrer">MXNET CNN Tutorial</a>.</p>
  
  <pre><code>def transform(data, label):
    # 2,0,1 means channels,width, height
    return nd.transpose(data.astype(np.float32), (2,0,1))/255, label.astype(np.float32)
  </code></pre>
  
  <p>Can any one explain why do we do this transformation?</p>