Theano Tutorial文档翻译(八) - 怎样标准化Theano的信息
2016-08-16 21:12
525 查看
原文地址:http://deeplearning.net/software/theano/tutorial/shape_info.html
严格给定Theano变量的形状是不太可能的,当一个特定值被在实时提供到Theano函数是,函数会确定条件的形状。
目前,不管形状Theano的信息在两种方法被使用:
- 当标准形状提前被知道时,为了生成更快的C代码在CPU和GPU的2维卷积。
- 当我们只需要知道形状而不需要具体的值时。
输出的编译函数不会包括任意乘法或乘方。Theano移除了他们为了直接计算他们的形状。
严格给定Theano变量的形状是不太可能的,当一个特定值被在实时提供到Theano函数是,函数会确定条件的形状。
目前,不管形状Theano的信息在两种方法被使用:
- 当标准形状提前被知道时,为了生成更快的C代码在CPU和GPU的2维卷积。
- 当我们只需要知道形状而不需要具体的值时。
import theano x = theano.tensor.matrix('x') f = theano.function([x], (x**2).shape) theano.printing.debugprint(f) #MakeVector{dtype='int64'} [id A] '' 2 # |Shape_i{0} [id B] '' 1 # | |x [id C] # |Shape_i{1} [id D] '' 0 # |x [id C]
输出的编译函数不会包括任意乘法或乘方。Theano移除了他们为了直接计算他们的形状。
Shape Inference Problem 形状确定问题
Theano在图里传播形状的信息。有时候会带来问题。import numpy import theano x = theano.tensor.matrix('x') y = theano.tensor.matrix('y') z = theano.tensor.join(0, x, y) xv = numpy.random.rand(5,4) yv = numpy.random.rand(3,3)
f = theano.function([x, y], z.shape) theano.printing.debugprint(f) #MakeVector{dtype='int64'} [id A] '' 4 # |Elemwise{Add}[(0, 0)] [id B] '' 3 # | |Shape_i{0} [id C] '' 1 # | | |x [id D] # | |Shape_i{0} [id E] '' 2 # | |y [id F] # |Shape_i{1} [id G] '' 0 # |x [id D]
f(xv, yv) # 没有问题
f = theano.function([x,y],z) theano.orinting.debugprintf(f) #Join [id A] '' 0 # |TensorConstant{0} [id B] # |x [id C] # |y [id D]
f(xv, yv) # 出错
相关文章推荐
- Theano Tutorial文档翻译(七) - 循环
- Theano Tutorial文档翻译(三) - 基础张量功能
- Theano Tutorial文档翻译(六) - 条件
- Theano Tutorial文档翻译(五) - 衍生工具
- Theano Tutorial文档翻译(一):词汇
- Theano Tutorial文档翻译(二):代数
- theano tutorial -- 用theano实现逻辑回归LR(三)theano实现LR算法
- theano tutorial -- 用theano实现逻辑回归LR(二)计算图结构
- 深度学习Theano教程Theano tutorial
- theano tutorial -- 用theano实现逻辑回归LR(一)theano基础知识
- Theano Tutorial文档翻译(四) - 更多例子
- deep learning tutorial 翻译 (theano 学习笔记)
- Apache OFBiz Development The Beginners Tutorial 翻译之三 使用Derby——OFBiz原装数据库
- Deep learning with Theano 官方中文教程(翻译)(三)——多层感知机(MLP)
- Theano学习三----Theano function
- unbutu12.04 64bit系统 安装theano+cuda5.5,并运行deeplearningtutorial里面的代码
- Deep learning with Theano 官方中文教程(翻译)(四)—— 卷积神经网络(CNN)
- oracle bbed 文档<Disassembling the Oracle Data Block> 翻译(2)
- theano linear regression exercise(theano 线性回归练习)
- oracle bbed 文档Disassembling the Oracle Data Block 翻译(3)