theano中 founction的用法
来源:互联网 发布:php常用全局变量 编辑:程序博客网 时间:2024/05/18 02:48
代码说明:
import theanoimport theano.tensor as Tprint 'theano.scan_module.until:'class GRU: def __init__(self,word_dim): self.word_dim = word_dim self.theano = {} self.__Thea_build__() def __Thea_build__(self): def prod_2(pre_value, max_value): print "what-what" return pre_value*2, theano.scan_module.until(pre_value*2 > max_value) max_value = T.iscalar('max_value') result, update = theano.scan(prod_2, outputs_info=T.constant(1.), non_sequences=[max_value], n_steps=100) self.prod_fn = theano.function([max_value], result, updates=update)mode = GRU(3)print "-----------------------------"for i in range(100,500,100): print mode.prod_fn(i)
执行前需要先编译一下
输出:[@104_27 theano_test]$ python theano_function.py
Using gpu device 0
theano.scan_module.until:
what-what
-----------------------------
[ 2. 4. 8. 16. 32. 64. 128.]
[ 2. 4. 8. 16. 32. 64. 128. 256.]
[ 2. 4. 8. 16. 32. 64. 128. 256. 512.]
[ 2. 4. 8. 16. 32. 64. 128. 256. 512.]
0 0
- theano中 founction的用法
- theano中对adadelta的实现
- Theano 中 scan 函数的参数解释
- 深度学习Theano中scan的使用方法
- Theano中scan函数的使用
- Theano中遇到的一些问题
- 对theano中conv2d函数的理解
- matchname founction
- Theano dimshuffle函数用法
- import theano 导入失败的解决方法(+function用法)
- theano中训练方法和模型的一些写法
- Theano2.1.21-基础知识之theano中多核的支持
- scan——Theano中循环的实现
- theano中训练方法和模型的一些写法
- 在Ubuntu中安装以theano作为backend的keras
- c++ founction object
- Theano的安装
- Theano 库 的安装
- Altium Designer 10对集成库的理解
- Jetty 热部署会丢失Session
- formdata异步上传图片(文件)
- 封装的 php 函数实例 获取客户端IP 获取在线IP 获取url 获取当前站点的访问路径根目录 数字转人民币
- maven常用命令
- theano中 founction的用法
- 关于webView拦截H5网络请求数据,替换本地数据问题
- windows 配置端口转发
- nginx 配合 spring boot
- CSDN 彩色字体
- c++作业四
- 冒泡排序
- linux rc 启动项
- ORB 一种特征匹配替代方法:对比SIFT或SURF