tiny-dnn icon indicating copy to clipboard operation
tiny-dnn copied to clipboard

how to write customised layer?

Open amozom opened this issue 6 years ago • 2 comments

I try to write a customised layer, I begin with copy power_layer as power_layer_a and prodceed following step:

  • replace every power_layer with power_layer_a in power_layer_a

  • add #include "tiny_dnn/layers/power_layer_a.h" in layers.h

  • add using power_a = tiny_dnn::power_layer_a; under namespace tiny_dnn in tiny_dnn.h

But I can't use power_layer_a in main program with using pow = tiny_dnn::power_layer_a;, what should I do?

amozom avatar Mar 26 '19 06:03 amozom

have you figure out this problem? and i have the same demand

wupeng1131 avatar Apr 24 '19 07:04 wupeng1131

Look at https://github.com/tiny-dnn/tiny-dnn/pull/1014. Or fork directly at https://github.com/dmilos/tiny-dnn. Then overwrite files in your fork and search/replace softclip with your layer's name.

Here are in brief how to add new layer:

  • Modify: test/test.cpp

  • Modify: test/test_serialization.cpp

  • Modify: tiny_dnn/tiny_dnn.h

  • Modify: tiny_dnn/utils/serialization_functions.h

  • Modify: tiny_dnn/utils/serialization_layer_list.h

  • Create: test/test_my_special_layer_list.h

  • Create: tiny_dnn/activations/my_special_layer_list.h

  • Modify: AUTORS and REAME.md

dmilos avatar May 27 '19 06:05 dmilos