提交 8a134a31 authored 作者: Frederic's avatar Frederic

fix gh-855.

上级 f8e1fb6e
......@@ -59,11 +59,17 @@ class ScalarSharedVariable(_tensor_py_operators, SharedVariable):
@shared_constructor
def scalar_constructor(value, name=None, strict=False, allow_downcast=None):
def scalar_constructor(value, name=None, strict=False, allow_downcast=None,
borrow=False, ):
"""SharedVariable constructor for scalar values. Default: int64 or float64.
:note: We implement this using 0-d tensors for now.
:note: We ignore the borrow parameter as we convert value to an
ndarray (this is a new object). This respect the semantic of
borrow, as it is an hint to Theano that we can reuse it, this
isn't mandatory.
"""
if not isinstance(value, (numpy.number, float, int, complex)):
raise TypeError()
......
......@@ -617,3 +617,8 @@ test_shared_options = makeSharedTester(
cast_value_=numpy.asarray,
op_by_matrix_=False,
name='test_shared_options')
def test_scalar_shared_options():
# Simple test to make sure we do not loose that fonctionality.
theano.shared(value=0., name='lk', borrow=True)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论