title: Keras' convolution layer on images coming from circular/cyclic domain
body: <h3>The Need</h3>
  <p>Hello, I am experimenting the usage of CNNs on <strong>images which come from a cylindric domain</strong>, so I am interested to apply the Convolution layer in a circular (or cyclic) way. <em><strong>I mean a convolution layer that</strong></em> instead of padding the image with zeros would just <em><strong>wrap around the image</strong></em> (or the kernel around the image).</p>
  <h3>Thoughts, Searches and Ideas</h3>
  <p>Coming from a signal processing background I expected it were already covered: in fact when calculations are performed in the frequency domain (i.e. by means of DFT) this circularity comes from free, and rather extra effort (there called &quot;zero padding&quot;) is required <em>to avoid</em> circular equivocation.</p>
  <p>Well, ok: I learned that, because of kernel size being normally quite small, calculations can be done more conveniently in the base domain. I can't figure out any good reason why this should be unfeasible, so I hoped that some direct way to do a cyclic convolution existed.</p>
  <p>But I found no coverage for this function, neither in Keras nor in TensorFlow docs. Moreover, I found little or no really relevant discussion about this around: <a href="https://groups.google.com/forum/?utm_medium=email&amp;utm_source=footer#!search/circular$20convolution/torch7/nD_XFCJlOEk/TEtRT0taCQAJ" rel="nofollow noreferrer">Torch7 discussion</a></p>
  <p>So I am left with the following options:</p>
  <ul>
  <li>implement my own <code>CyclicConv2D</code> layer by subclassing Keras' <code>layer.Layer</code> class, as described <a href="https://www.tensorflow.org/guide/keras#custom_layers" rel="nofollow noreferrer">here</a></li>
  <li>submit my own pull request for an experimental new feature, as described <a href="https://keras.io/contributing/#requesting-a-feature" rel="nofollow noreferrer">here</a>. Shortly, I would think of adding some &quot;wrap&quot; value for the &quot;padding=&quot; parameter, or adding a new &quot;wrap=&quot; parameter. It should specify along which axes the image should wrap around. This in fact would likely be needed only along one dimension, the circular one, not both.</li>
  </ul>
  <h3>The Questions</h3>
  <p>Is there any more straightforward option, or source of information that I should address first?</p>
  <p>Otherwise, where can I find any advice how to implement the former?</p>
  <p>For the latter I must admit that I described it more to stimulate some collective thinking how it should be implemented from a user standpoint, but I don't really feel able to contribute a good pull request (i.e. one including good code). Anyway I will appreciate any advice where to start from.</p>