def get_params(cost, criterion=lambda x: hasattr(x, 'param') and x.param==True):
"""
Default criterion:
lambda x: hasattr(x, 'param') and x.param==True
This will return every parameter for cost from computation graph.
To exclude a parameter, just set 'param' to False:
>>> h0 = lib.param('h0',\
numpy.zeros((3, 2*512), dtype=theano.config.floatX))
>>> print h0.param # Default: True
>>> h0.param = False
In this case one still can get list of all params (False or True) by:
>>> lib.get_params(cost, lambda x: hasattr(x, 'param')
:returns:
A list of params
"""
return search(cost, criterion)
评论列表
文章目录