提交 25c4f78e authored 作者: abalkin's avatar abalkin

PEP8 reformat.

上级 443c0ad0
......@@ -3,23 +3,26 @@ import scipy.sparse
from theano.compile import shared_constructor, SharedVariable
from theano.sparse.basic import SparseType, _sparse_py_operators
class SparseTensorSharedVariable(_sparse_py_operators, SharedVariable):
pass
@shared_constructor
def sparse_constructor(value, name=None, strict=False, allow_downcast=None,
borrow=False, format = None):
borrow=False, format=None):
"""SharedVariable Constructor for SparseType
writeme
"""
if not isinstance(value, scipy.sparse.spmatrix):
raise TypeError("Expected a sparse matrix in the sparse shared variable constructor. Received: ",value.__class__)
raise TypeError("Expected a sparse matrix in the sparse shared variable constructor. Received: ",
value.__class__)
if format is None:
format = value.format
type = SparseType(format =format, dtype = value.dtype)
type = SparseType(format=format, dtype=value.dtype)
if not borrow:
value = copy.deepcopy(value)
return SparseTensorSharedVariable(type=type, value=value, name=name,
strict=strict, allow_downcast=allow_downcast)
strict=strict, allow_downcast=allow_downcast)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论