提交 65d27127 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Little bit of clean-up

上级 f714b302
...@@ -188,13 +188,11 @@ class _sparse_py_operators: ...@@ -188,13 +188,11 @@ class _sparse_py_operators:
if not isinstance(args, tuple): if not isinstance(args, tuple):
args = args, args = args,
scalar_var = tensor.iscalar()
if len(args) == 2: if len(args) == 2:
scalar_arg_1 = (numpy.isscalar(args[0]) or scalar_arg_1 = (numpy.isscalar(args[0]) or
getattr(args[0], 'type', None) == scalar_var.type) getattr(args[0], 'type', None) == tensor.iscalar)
scalar_arg_2 = (numpy.isscalar(args[1]) or scalar_arg_2 = (numpy.isscalar(args[1]) or
getattr(args[1], 'type', None) == scalar_var.type) getattr(args[1], 'type', None) == tensor.iscalar)
if scalar_arg_1 and scalar_arg_2: if scalar_arg_1 and scalar_arg_2:
ret = get_item_scalar(self, args) ret = get_item_scalar(self, args)
else: else:
...@@ -202,8 +200,8 @@ class _sparse_py_operators: ...@@ -202,8 +200,8 @@ class _sparse_py_operators:
else: else:
ret = get_item_2d(self, args) ret = get_item_2d(self, args)
return ret return ret
class SparseVariable(gof.Variable, _sparse_py_operators): class SparseVariable(gof.Variable, _sparse_py_operators):
dtype = property(lambda self: self.type.dtype) dtype = property(lambda self: self.type.dtype)
format = property(lambda self: self.type.format) format = property(lambda self: self.type.format)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论