zoukankan      html  css  js  c++  java
  • python 之 theano学习:

    (1)theano主要支持符号矩阵表达式

    (2)theano与numpy中都有broadcasting:numpy中是动态的,而theano需要在这之前就知道是哪维需要被广播。针对不同类型的数据给出如下的一张表,基本类型包括scalar、vector、row、col、matrix、tensor3、tensor4,然后有整形int对应的8、16、32、64位分别为b、w、i、l;float类型对应的32、64位为f、d;complex类型对应的64、128位为c、z。

    Constructordtypendimshapebroadcastable
    bscalar int8 0 () ()
    bvector int8 1 (?,) (False,)
    brow int8 2 (1,?) (True, False)
    bcol int8 2 (?,1) (False, True)
    bmatrix int8 2 (?,?) (False, False)
    btensor3 int8 3 (?,?,?) (False, False, False)
    btensor4 int8 4 (?,?,?,?) (False, False, False, False)
    wscalar int16 0 () ()
    wvector int16 1 (?,) (False,)
    wrow int16 2 (1,?) (True, False)
    wcol int16 2 (?,1) (False, True)
    wmatrix int16 2 (?,?) (False, False)
    wtensor3 int16 3 (?,?,?) (False, False, False)
    wtensor4 int16 4 (?,?,?,?) (False, False, False, False)
    iscalar int32 0 () ()
    ivector int32 1 (?,) (False,)
    irow int32 2 (1,?) (True, False)
    icol int32 2 (?,1) (False, True)
    imatrix int32 2 (?,?) (False, False)
    itensor3 int32 3 (?,?,?) (False, False, False)
    itensor4 int32 4 (?,?,?,?) (False, False, False, False)
    lscalar int64 0 () ()
    lvector int64 1 (?,) (False,)
    lrow int64 2 (1,?) (True, False)
    lcol int64 2 (?,1) (False, True)
    lmatrix int64 2 (?,?) (False, False)
    ltensor3 int64 3 (?,?,?) (False, False, False)
    ltensor4 int64 4 (?,?,?,?) (False, False, False, False)
    dscalar float64 0 () ()
    dvector float64 1 (?,) (False,)
    drow float64 2 (1,?) (True, False)
    dcol float64 2 (?,1) (False, True)
    dmatrix float64 2 (?,?) (False, False)
    dtensor3 float64 3 (?,?,?) (False, False, False)
    dtensor4 float64 4 (?,?,?,?) (False, False, False, False)
    fscalar float32 0 () ()
    fvector float32 1 (?,) (False,)
    frow float32 2 (1,?) (True, False)
    fcol float32 2 (?,1) (False, True)
    fmatrix float32 2 (?,?) (False, False)
    ftensor3 float32 3 (?,?,?) (False, False, False)
    ftensor4 float32 4 (?,?,?,?) (False, False, False, False)
    cscalar complex64 0 () ()
    cvector complex64 1 (?,) (False,)
    crow complex64 2 (1,?) (True, False)
    ccol complex64 2 (?,1) (False, True)
    cmatrix complex64 2 (?,?) (False, False)
    ctensor3 complex64 3 (?,?,?) (False, False, False)
    ctensor4 complex64 4 (?,?,?,?) (False, False, False, False)
    zscalar complex128 0 () ()
    zvector complex128 1 (?,) (False,)
    zrow complex128 2 (1,?) (True, False)
    zcol complex128 2 (?,1) (False, True)
    zmatrix complex128 2 (?,?) (False, False)
    ztensor3 complex128 3 (?,?,?) (False, False, False)
    ztensor4 complex128 4 (?,?,?,?) (False, False, False, False)

    3、python中不同目录之间.py文件的引用:(1)在当前目录,直接通过import文件名去后缀即可;(2)包中包含__init__.py文件以及其他的一些.py文件,通过

    from package_name import module_name或者

    from package_name import *即可引用;(3)通过将py所对应的目录添加到该py对应的引用文件搜索路径即可;

    上面的(2)中要区别对待从module中引用属性与方法--------------什么时候你应该使用 from module import?

    • 如果你要经常访问模块的属性和方法,且不想一遍又一遍地敲入模块名,使用 from module import。
    • 如果你想要有选择地导入某些属性和方法,而不想要其它的,使用 from module import。
    • 如果模块包含的属性和方法与你的某个模块同名,你必须使用 import module 来避免名字冲突。
  • 相关阅读:
    左偏树
    论在Windows下远程连接Ubuntu
    ZOJ 3711 Give Me Your Hand
    SGU 495. Kids and Prizes
    POJ 2151 Check the difficulty of problems
    CodeForces 148D. Bag of mice
    HDU 3631 Shortest Path
    HDU 1869 六度分离
    HDU 2544 最短路
    HDU 3584 Cube
  • 原文地址:https://www.cnblogs.com/ct1104/p/4094183.html
Copyright © 2011-2022 走看看