theano 入门教程1.3

theano 入门教程1.3
  1. 给一个参数设置默认值

    # -*- coding: utf-8 -*-

    """

    Created on Wed Jun  4 23:22:17 2014


    @author: wencc

    """


    import theano.tensor as T

    from theano import function

    from theano import Param

    from theano import pp


    if __name__ == "__main__":

    x, y , w= T.dscalars('x', 'y', 'w')

    z = x + y + w

    f = function([x, Param(y, default=1), Param(w, default=2, name='w_by_name')], z)

    print f(33, 2, w_by_name=4)

    print pp(z)

这里用Param给一个变量设置默认参数。






posted @ 2014-06-06 13:46  fireae  阅读(306)  评论(0编辑  收藏  举报