fengfu-chris / caffe-twns

Implementation of Ternary Weight Networks In Caffe
https://arxiv.org/abs/1605.04711
63 stars 23 forks source link

Per Layer Ternarization #5

Open HahTK opened 7 years ago

HahTK commented 7 years ago

The boolean controlling ternarization in binary.hpp seems to affect all inner_product and conv layers. That suggests that either all layers are either ternarized or not. Is there a way to ternarize only some layers ?

I'm thinking of creating a new layer type inner_product_twn and conv_twn and revert the original inner_product and conv layers to baseline caffe behavior. Do you see any problems with this approach ?

Also, the alpha and delta are computed separately for each layer correct ?

fengfu-chris commented 7 years ago

@HahTK Yes, per layer ternarization is possible when you revise the source file of inner_product layers and cnn layers. One way is to add a parameter that controls whether a layer should be ternarized. In the .prototxt file that defines the network architecture, the true value of the parameters can be defined and be passed to the source files.