<p>important is this paper <a href="https://arxiv.org/pdf/1802.07088.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1802.07088.pdf</a> - <em>i-REVNET: DEEP INVERTIBLE NETWORKS</em> and this git <a href="https://github.com/jhjacobsen/pytorch-i-revnet" rel="nofollow noreferrer">https://github.com/jhjacobsen/pytorch-i-revnet</a></p>

<p>when reading the above paper critical components in i-RevNets are <strong>homeomorphic layers</strong>, on the link between topology and neural nets  cf <a href="http://colah.github.io/posts/2014-03-NN-Manifolds-Topology/" rel="nofollow noreferrer">http://colah.github.io/posts/2014-03-NN-Manifolds-Topology/</a> - <strong>Neural Networks, Manifolds, and Topology</strong> ( search for 'homeomorphic' ) </p>

<p>in <a href="https://github.com/jhjacobsen/pytorch-i-revnet" rel="nofollow noreferrer">https://github.com/jhjacobsen/pytorch-i-revnet</a> homeomorphic layers are implemented in <code>class irevnet_block(nn.Module)</code>, note that there are <strong>NO</strong> operations that discard information like <strong>maxpooling, averaging, ...</strong> ( with exception of the output layer ), only <em>batch normalization</em> ( <a href="https://towardsdatascience.com/batch-normalization-in-neural-networks-1ac91516821c" rel="nofollow noreferrer">https://towardsdatascience.com/batch-normalization-in-neural-networks-1ac91516821c</a> ) is applied, the ReLUs are also locally strictly linear.</p>

<p>in <a href="https://stackoverflow.com/questions/34716454/where-do-i-call-the-batchnormalization-function-in-keras">Where do I call the BatchNormalization function in Keras?</a> is how to implement this in keras, simply stack the layers into a homeomorphic layer: </p>

<pre><code>homeomorphic layer -&gt; NO POOLING, ... LAYERS
model.add(Dense(64, init='uniform'))
model.add(Activation('relu'))
model.add(BatchNormalization())
</code></pre>

<p>the rest of the code in <a href="https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/iRevNet.py" rel="nofollow noreferrer">https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/iRevNet.py</a> like i.e. <code>def inverse(self, x)</code> or <code>def forward(self, x)</code> can be reproduced using the keras functions in <a href="https://keras.io/layers/merge/" rel="nofollow noreferrer">https://keras.io/layers/merge/</a> . Cf <a href="https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/model_utils.py" rel="nofollow noreferrer">https://github.com/jhjacobsen/pytorch-i-revnet/blob/master/models/model_utils.py</a> on the <code>merge</code> and <code>split</code> functions, they use <code>torch.cat</code> and <code>torch.split</code> whichs keras equivalents are in <a href="https://keras.io/layers/merge/" rel="nofollow noreferrer">https://keras.io/layers/merge/</a></p>
i-RevNet on keras on MNIST dataset
<p>I want to implement i-RevNet on MNIST dataset on keras and generate the original 28*28 input images from the output of i-RevNet, but i don't have a clue. Online resources I can find are all based on tensorflow.</p>