Goran
Goran

Reputation: 11

User defined activation function in CNTK

Is there way to provide user defined activation function for layers in CNTK (Python API) instead of only primitive ones like tanh, relu etc.? Something like this

def f(x):
    return x * x
LSTM(number_of_cells, activation=f)

Upvotes: 1

Views: 244

Answers (2)

Emad Barsoum
Emad Barsoum

Reputation: 476

What you wrote should work, you can use any of the CNTK expression to compose a more complex activation function.

Upvotes: 0

ChaZ
ChaZ

Reputation: 179

Yes, what you wrote should work as is.

This tutorial might be useful to you: https://www.cntk.ai/Tutorials/CVPR2017/CVPR_2017_Tutorial_final.pdf

Also, CNTK has a number of tutorials and manuals: https://github.com/Microsoft/CNTK/tree/master/Tutorials https://github.com/Microsoft/CNTK/tree/master/Manual

Upvotes: 1

Related Questions