virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
+ // Disallow PythonLayer in MultiGPU training stage, due to GIL issues
+ // Details: https://github.com/BVLC/caffe/issues/2936
+ if (this->phase_ == TRAIN && Caffe::solver_count() > 1
+ && !ShareInParallel()) {
+ LOG(FATAL) << "PythonLayer is not implemented in Multi-GPU training";
+ }
self_.attr("param_str") = bp::str(
this->layer_param_.python_param().param_str());
self_.attr("setup")(bottom, top);