def param(name, *args, **kwargs):
"""
A wrapper for `theano.shared` which enables parameter sharing in models.
Creates and returns theano shared variables similarly to `theano.shared`,
except if you try to create a param with the same name as a
previously-created one, `param(...)` will just return the old one instead of
making a new one.
This constructor also adds a `param` attribute to the shared variables it
creates, so that you can easily search a graph for all params.
"""
if name not in _params:
kwargs['name'] = name
param = theano.shared(*args, **kwargs)
param.param = True
_params[name] = param
return _params[name]
评论列表
文章目录