title: How can I implement this layer similar to Conv2D using tensorflow?
body: <p>I want to make a neural network layer similar to Conv2D using <code>tensorflow</code>.
  Below is what I want to implement. A layer uses a kernel just like convolution layer but the output is larger than the input.</p>
  
  <p><a href="https://i.imgur.com/LXoVfei.png" rel="nofollow noreferrer">The layer image that I want to implement</a></p>
  
  <p>However, it seems there is no way I can implement that using only <code>tensorflow</code> operations.
  I managed to implement the below code by converting <code>tensorflow</code> tensors to <code>numpy</code> arrays but I still have no idea how to merge 4D output array into 2D array.</p>
  
  <pre><code>input = [[a, b],
           [c, d]]
  kernel = [[1, -1],
            [2, 1]]
  output = [[input[0][0] * kernel, input[0][1] * kernel],
            [input[1][0] * kernel, input[1][1] * kernel]]
  
  #since "input[0][0] * kernel" is 2D, "output" becomes 4D array.
  </code></pre>
  
  <p>Is there any way I can implement this using only <code>tensorflow</code>?
  If not, what method should I use instead?</p>