theano 入門教程1.3
給一個參數設定預設值
#
-*- coding: utf-8 -*-
"""
Created
on Wed Jun 4 23:22:17 2014
@author:
wencc
import
theano.tensor as T
from
theano import function
theano import Param
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)
f(33, 2, w_by_name=4)
pp(z)
這裡用Param給一個變量設定預設參數。