def sharedX_value(value, name=None, borrow=None, dtype=None):
"""Share a single value after transforming it to floatX type.
value: a value
name: variable name (str)
borrow: boolean
dtype: the type of the value when shared. default: theano.config.floatX
"""
if dtype is None:
dtype = theano.config.floatX
return theano.shared(
theano._asarray(value, dtype=dtype), name=name, borrow=borrow)
评论列表
文章目录