1

I want to learn how to write caffe python layers.
But I only find examples about very simple layers like pyloss.

How to write python caffe with trainable parameters?

For example, how to write a fully connected python layer?

Shai
  • 111,146
  • 38
  • 238
  • 371
kli_nlpr
  • 894
  • 2
  • 11
  • 25
  • Possible duplicate of [Caffe: how to get the phase of a Python layer?](http://stackoverflow.com/questions/34549743/caffe-how-to-get-the-phase-of-a-python-layer) – Shai Jan 27 '16 at 06:17
  • @Shai, I don't think this two are the same question. My question is how to creat a python layer with parameters, for example, how to implement a python fully connected layers? – kli_nlpr Jan 27 '16 at 06:27
  • The other question is about writing a python layer with parameters - which is exactly the title of your question. – Shai Jan 27 '16 at 06:29
  • Thank you @Shai, I will edit my question more clearly. – kli_nlpr Jan 27 '16 at 06:30

1 Answers1

1

Caffe stores the layer's trainable parameters as a vector of blobs. By default this vector is empty and it is up to you to add parameters blobs to it in the setup of the layer. There is a simple example for a layer with parameters in test_python_layer.py.

See this post for more information about "Python" layers in caffe.

Community
  • 1
  • 1
Shai
  • 111,146
  • 38
  • 238
  • 371