title: Creating a new matrix from a tensor in tensorflow
body: <p>Let's say I have a (7,7,3) image with 3 channels. 
  How can I create a matrix A using the image such that the each row consist of just the pairwise connections of the neighbouring pixel? I know this can be done easily in python with for loops but how can we do this within a tensorflow graph? </p>
  
  <p>Example of matrix A: </p>
  
  <pre><code>[[pixel1 pixel2],
   [pixel1 pixel3],
   [pixel1 pixel4],
   .....so on    ]]
  </code></pre>