how to get the phase of a "Python" layer?

351 views
Skip to first unread message

Shai Bagon

unread,
Dec 31, 2015, 2:37:59 PM12/31/15
to Caffe Users

I created a "Python" layer "myLayer" in caffe, and use it in the net train_val.prototxt I insert the layer like this:

layer {
  name: "my_py_layer"
  type: "Python"
  bottom: "in"
  top: "out"
  python_param {
    module: "my_module_name"
    layer: "myLayer"
  }
  include { phase: TRAIN } # THIS IS THE TRICKY PART!
}

Now, my layer only participates in the TRAINing phase of the net, 
how can I know that in my layer's setup function??

class myLayer(caffe.Layer):
  def setup(self, bottom, top):
     # I want to know here what is the phase?!!
  ...


I posted this question on stackoverflow as well,


Thank you for your help.

Shai Bagon

unread,
Jan 4, 2016, 5:15:29 AM1/4/16
to Caffe Users
I found out that a "Python" layer can get arbitrary param string from the net prototxt using `python_param: { param_str: "" }`.

See this SO thread for more details.
Reply all
Reply to author
Forward
0 new messages