theano tutorial(八)Shape Information

本文详细解析了Theano库中的debugprint函数,用于输出计算图作为文本,包括节点的类型、名称、深度和存储映射等信息,提供了一个深入理解Theano计算流程的方法。

首先上 关于输出shape信息的这个函数

特别多,大致翻译一下

def debugprint(obj, depth=-1, print_type=False,
               file=None, ids='CHAR', stop_on_name=False,
               done=None, print_storage=False):
    """Print a computation graph as text to stdout or a file.

    :type obj: Variable, Apply, or Function instance
    :param obj: symbolic thing to print
    :type depth: integer
    :param depth: print graph to this depth (-1 for unlimited)
    :type print_type: boolean
    :param print_type: whether to print the type of printed objects
    :type file: None, 'str', or file-like object
    :param file: print to this file ('str' means to return a string)
    :type ids: str
    :param ids: How do we print the identifier of the variable
                id - print the python id value
                int - print integer character
                CHAR - print capital character
                "" - don't print an identifier
    :param stop_on_name: When True, if a node in the graph has a name,
                         we don't print anything below it.
    :type done: None or dict
    :param done: A dict where we store the ids of printed node.
        Useful to have multiple call to debugprint share the same ids.
    :type print_storage: bool
    :param print_storage: If True, this will print the storage map
        for Theano functions. Combined with allow_gc=False, after the
        execution of a Theano function, we see the intermediate result.

    :returns: string if `file` == 'str', else file arg

    Each line printed represents a Variable in the graph.
    The indentation of lines corresponds to its depth in the symbolic graph.
    The first part of the text identifies whether it is an input
    (if a name or type is printed) or the output of some Apply (in which case
    the Op is printed).
    The second part of the text is an identifier of the Variable.
    If print_type is True, we add a part containing the type of the Variable

    If a Variable is encountered multiple times in the depth-first search,
    it is only printed recursively the first time. Later, just the Variable
    identifier is printed.

    If an Apply has multiple outputs, then a '.N' suffix will be appended
    to the Apply's identifier, to indicate which output a line corresponds to.

    """
将一个computation graph作为文本输出到终端或者文件

    :type obj: 变量,Apply或者函数
    :param obj: 要数出的符号
    :type depth: 实数r
    :param depth: 输出的深度为(限制为-1)
    :type print_type: boolean
    :param print_type: 是否输出输出对象的类型
    :type file: 空,字符串,或者文件对象
    :param file: 输出文件 ('str' 就是返回字符串)
    :type ids: str
    :param ids:怎样输出变量的标识符
                id - 输出python的id值
                int - 输出int型的表达式
                CHAR - print capital character
                "" - 不要输出一个标识符
    :param stop_on_name: 如果为真, 如果图中的一个节点右名字,
                         在它的下面部署出任何东西.
    :type done: 空或者字典
    :param done: 一个字典,这个字典存储来要输出节点的id.
        在多次调用共享同一个id的debugprint方法时非常有用
    :type print_storage: bool
    :param print_storage: 如果为真, 将会给theano funtion输出一个存储map
        . Combined with allow_gc=False, after the
        .在执行这个Theabo function 之后,我们将会看见中间结果
    :returns: string if `file` == 'str', else file arg

    每一行代表来graph中的一个变量
    行的排列和缩进代表了这个比变量在图中的深度
    文本的第一部分表示这是否是一个输入
    (如果输出来名字和类型) 或者是一个输出或者Apply节点
    (这时输出操作符).
    第二部分是变量的标识符
    如果print_type为真,我们将会加上一个部分,这个部分包含这个变量的类型

    如果一个变量在一个深度优先搜诉中出现来多次
    在这个递归过程中,他只会被输出一次,指数出这个变量的标识符
     
    如果一个Apply有多个输出,那么这个Apply标识符将会被添加
    一个'.N'后缀,来区分这个输出对应着哪一行


下面看官方文档给出的例子

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]#输出来它的name,所以是一个input,[id C]是它的标识符
 |Shape_i{1} [id D] ''   0
   |x [id C]


先这样,并不是很懂,感觉要把后面graph那一课看了再回来

标题基于Python的自主学习系统后端设计与实现AI更换标题第1章引言介绍自主学习系统的研究背景、意义、现状以及本文的研究方法和创新点。1.1研究背景与意义阐述自主学习系统在教育技术领域的重要性和应用价值。1.2国内外研究现状分析国内外在自主学习系统后端技术方面的研究进展。1.3研究方法与创新点概述本文采用Python技术栈的设计方法和系统创新点。第2章相关理论与技术总结自主学习系统后端开发的相关理论和技术基础。2.1自主学习系统理论阐述自主学习系统的定义、特征和理论基础。2.2Python后端技术栈介绍DjangoFlask等Python后端框架及其适用场景。2.3数据库技术讨论关系型和非关系型数据库在系统中的应用方案。第3章系统设计与实现详细介绍自主学习系统后端的设计方案和实现过程。3.1系统架构设计提出基于微服务的系统架构设计方案。3.2核心模块设计详细说明用户管理、学习资源管理、进度跟踪等核心模块设计。3.3关键技术实现阐述个性化推荐算法、学习行为分析等关键技术的实现。第4章系统测试与评估对系统进行功能测试和性能评估。4.1测试环境与方法介绍测试环境配置和采用的测试方法。4.2功能测试结果展示各功能模块的测试结果和问题修复情况。4.3性能评估分析分析系统在高并发等场景下的性能表现。第5章结论与展望总结研究成果并提出未来改进方向。5.1研究结论概括系统设计的主要成果和技术创新。5.2未来展望指出系统局限性并提出后续优化方向。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值