<p>So you want to use instead of WX+b a different function for your neurons. Well in tensorflow you explicitly calculate this product, so for example you do</p>

<pre><code>y_ = tf.matmul(X, W)
</code></pre>

<p>you simply have to write your formula and let the network learn. It should not be difficult to implement. </p>

<p>In addition what you are trying to do (according to the paper you link) is called batch normalization and is relatively standard. The idea being you normalize your intermediate steps (in the different layers). Check for example <a href="https://www.google.ch/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;ved=0ahUKEwikh-HM7PnWAhXDXRQKHZJhD9EQFggyMAE&amp;url=https%3A%2F%2Farxiv.org%2Fabs%2F1502.03167&amp;usg=AOvVaw1nGzrGnhPhNGEczNwcn6WK" rel="nofollow noreferrer">https://www.google.ch/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;ved=0ahUKEwikh-HM7PnWAhXDXRQKHZJhD9EQFggyMAE&amp;url=https%3A%2F%2Farxiv.org%2Fabs%2F1502.03167&amp;usg=AOvVaw1nGzrGnhPhNGEczNwcn6WK</a> or <a href="https://www.google.ch/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=4&amp;ved=0ahUKEwikh-HM7PnWAhXDXRQKHZJhD9EQFghCMAM&amp;url=https%3A%2F%2Fbcourses.berkeley.edu%2Ffiles%2F66022277%2Fdownload%3Fdownload_frd%3D1%26verifier%3DoaU8pqXDDwZ1zidoDBTgLzR8CPSkWe6MCBKUYan7&amp;usg=AOvVaw0AHLwD_0pUr1BSsiiRoIFc" rel="nofollow noreferrer">https://www.google.ch/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=4&amp;ved=0ahUKEwikh-HM7PnWAhXDXRQKHZJhD9EQFghCMAM&amp;url=https%3A%2F%2Fbcourses.berkeley.edu%2Ffiles%2F66022277%2Fdownload%3Fdownload_frd%3D1%26verifier%3DoaU8pqXDDwZ1zidoDBTgLzR8CPSkWe6MCBKUYan7&amp;usg=AOvVaw0AHLwD_0pUr1BSsiiRoIFc</a></p>

<p>Hope that helps,
Umberto</p>
How to obtain the Tensorflow code version of a NN built in Keras?
<p>I have been working with Keras for a week or so. I know that Keras can use either TensorFlow or Theano as a backend. In my case, I am using TensorFlow.</p>

<p>So I'm wondering: is there a way to write a NN in Keras, and then print out the equivalent version in TensorFlow?</p>

<p><strong>MVE</strong></p>

<p>For instance suppose I write</p>

<pre><code>    #create seq model
    model = Sequential()
    # add layers
    model.add(Dense(100, input_dim = (10,), activation = 'relu'))
    model.add(Dense(1, activation = 'linear'))
    # compile model
    model.compile(optimizer = 'adam', loss = 'mse')
    # fit
    model.fit(Xtrain, ytrain, epochs = 100, batch_size = 32)
    # predict
    ypred = model.predict(Xtest, batch_size = 32)
    # evaluate
    result = model.evaluate(Xtest)
</code></pre>

<p>This code might be wrong, since I just started, but I think you get the idea. </p>

<p>What I want to do is write down this code, run it (or not even, maybe!) and then have a function or something that will produce the TensorFlow code that Keras has written to do all these calculations.</p>