caffe python layer初次使用记录
2016-08-25 20:52
267 查看
书写方式举例 layer{ name: "Leaky25" type: "Python" bottom: "connect1" top: "Leaky25" python_param{ module: "mylayer"#python的文件名字为mylayer.py layer: "LeakyLayer"#层的名称为LeakyLayer } }
层的实现: import caffe import numpy as np import yaml class LeakyLayer(caffe.Layer): def setup(self, bottom, top): pass def reshape(self, bottom, top): print "reshape" top[0].reshape(*(bottom[0].shape)) def forward(self, bottom, top): print "forward" count = bottom[0].count data_bot = bottom[0].data data_top = top[0].data shape = data_bot.shape for i in xrange(shape[0]): for j in xrange(shape[1]): if data_bot[i][j] < 0: data_top[i][j] = data_bot[i][j]*0.1 else: data_top[i][j] = data_bot[i][j] def backward(self, top, propagate_down, bottom): pass
相关文章推荐
- caffe python接口使用记录
- 在Caffe中使用Python Layer
- Python里pycurl使用记录
- boost.python的安装配置和初次使用
- 用python 处理字符串,初次使用后感受
- python-使用正则快速解析QQ群聊记录
- python xml包 xml.etree.ElementTree使用记录
- 初次使用Ajax.net,总结下心得并记录下来
- [Python]logging模块使用basicConfig后记录日志重复问题
- python使用QtWebKit代码记录
- python 初次使用twisted
- Python3.2官方文档翻译--使用二进制数据记录布局和多线程
- Python里pycurl使用记录
- Python:通过自定义系统级快捷键来控制程序开始或停止记录日志(使用小技巧解决一个貌似无解的问题)
- Python:通过自定义系统级快捷键来控制程序开始或停止记录日志(使用小技巧解决一个貌似无解的问题)
- cocos2d-x 2.1.4 使用python 创建项目指令:记录
- 初次使用Eclipse下的Python编程
- 使用Python读取TestTrack记录- Part3 动态生成Linq to xml查询语句筛选条件
- python 学习记录(2)—re 正则表达式模块的使用
- python使用twisted里log模块操作text记录日志