I want to perform feed forward propagation on CNN using Keras. I am trying to train CNN using my own optimizer, which I can't fit in the optimiser file of Keras. My optimiser in gradient free. I don't want any inbuilt to be used.
Asked
Active
Viewed 1,309 times
0

desertnaut
- 57,590
- 26
- 140
- 166

Bhaskar Dhariyal
- 1,343
- 2
- 13
- 31
-
What do you mean by 'gradient free'? – Maxim Nov 11 '17 at 08:28
-
Gradient free means no gradients are calculated. Basically Evolutionary Algorithms(EAs) are considered to be gradient free. – Bhaskar Dhariyal Nov 11 '17 at 08:58
-
OK. But how does it relate to convolutional neural networks? – Maxim Nov 11 '17 at 09:01
-
I think that will be beyond the scope of question. I am open to discussion if you want to discuss personally. Please mail at bdhariyal94@gmail.com. – Bhaskar Dhariyal Nov 11 '17 at 09:08
-
With respect to question, I don't want any optimiser to be involved now, I want to do it manually. – Bhaskar Dhariyal Nov 11 '17 at 09:15
1 Answers
0
I found answer to this question. We just have to make model non trainable.
import numpy as np
import keras
x = keras.layers.Input(shape=(3,))
y = keras.layers.Dense(5)(x)
model = keras.models.Model(x, y)
model.trainable = False
model.compile(optimizer='rmsprop', loss='mse')
x = np.random.random((10, 3))
y = np.random.random((10, 5))
model.fit(x, y, epochs=10)

Bhaskar Dhariyal
- 1,343
- 2
- 13
- 31