Layer类在caffe的(核心)C ++代码中实现。 ( 链接 ) Boost Python包装器定义了如下接口,如下所示 蟒蛇/ _caffe.cpp (编译为python / caffe / _caffe.so):
bp::class_<Layer<Dtype>, shared_ptr<PythonLayer<Dtype> >, boost::noncopyable>("Layer", bp::init<const LayerParameter&>())
然后由此导入此接口 caffe模块初始化 :
from ._caffe import init_log, log, set_mode_cpu, set_mode_gpu, set_device, **Layer**