提交 2b1796cc authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Remove combination of @classmethod and @property

上级 43dbf17b
...@@ -7392,11 +7392,6 @@ class AdvancedIncSubtensor(Op): ...@@ -7392,11 +7392,6 @@ class AdvancedIncSubtensor(Op):
self.allow_legacy_perform = False self.allow_legacy_perform = False
@classmethod
@property
def increment_available():
return inplace_increment is not None
def __hash__(self): def __hash__(self):
return hash((type(self), self.inplace, self.set_instead_of_inc)) return hash((type(self), self.inplace, self.set_instead_of_inc))
...@@ -7417,7 +7412,7 @@ class AdvancedIncSubtensor(Op): ...@@ -7417,7 +7412,7 @@ class AdvancedIncSubtensor(Op):
op = self op = self
# If we are incrementing, but the increment compiled function is not # If we are incrementing, but the increment compiled function is not
# available, we need to support legacy cases. # available, we need to support legacy cases.
if not self.set_instead_of_inc and not self.increment_available: if not self.set_instead_of_inc and inplace_increment is None:
legacy_conditions = False legacy_conditions = False
if x.ndim == 2 and y.ndim == 1 and len(inputs) == 2: if x.ndim == 2 and y.ndim == 1 and len(inputs) == 2:
ind1 = as_tensor_variable(inputs[0]) ind1 = as_tensor_variable(inputs[0])
......
...@@ -43,7 +43,7 @@ from theano.tensor import (_shared, wvector, bvector, autocast_float_as, ...@@ -43,7 +43,7 @@ from theano.tensor import (_shared, wvector, bvector, autocast_float_as,
ScalarFromTensor, TensorFromScalar, dtensor4, Rebroadcast, Alloc, ScalarFromTensor, TensorFromScalar, dtensor4, Rebroadcast, Alloc,
dtensor3, SpecifyShape, Mean, IncSubtensor, AdvancedIncSubtensor1, dtensor3, SpecifyShape, Mean, IncSubtensor, AdvancedIncSubtensor1,
itensor3, Tile, AdvancedIncSubtensor, switch, Diagonal, Diag, itensor3, Tile, AdvancedIncSubtensor, switch, Diagonal, Diag,
nonzero, flatnonzero, nonzero_values) nonzero, flatnonzero, nonzero_values, inplace_increment)
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
...@@ -3750,7 +3750,7 @@ class TestAdvancedSubtensor(unittest.TestCase): ...@@ -3750,7 +3750,7 @@ class TestAdvancedSubtensor(unittest.TestCase):
a.broadcastable, self.ix2.broadcastable) a.broadcastable, self.ix2.broadcastable)
def test_inc_adv_selection(self): def test_inc_adv_selection(self):
if not AdvancedIncSubtensor.increment_available: if inplace_increment is None:
raise SkipTest("inc_subtensor with advanced indexing not enabled. " raise SkipTest("inc_subtensor with advanced indexing not enabled. "
"Installing NumPy 1.8 or the latest development version " "Installing NumPy 1.8 or the latest development version "
"should make that feature available.") "should make that feature available.")
...@@ -3764,7 +3764,7 @@ class TestAdvancedSubtensor(unittest.TestCase): ...@@ -3764,7 +3764,7 @@ class TestAdvancedSubtensor(unittest.TestCase):
assert numpy.allclose(aval, [.4, .9 * 3, .1 * 3]) assert numpy.allclose(aval, [.4, .9 * 3, .1 * 3])
def test_inc_adv_selection2(self): def test_inc_adv_selection2(self):
if not AdvancedIncSubtensor.increment_available: if inplace_increment is None:
raise SkipTest("inc_subtensor with advanced indexing not enabled. " raise SkipTest("inc_subtensor with advanced indexing not enabled. "
"Installing NumPy 1.8 or the latest development version " "Installing NumPy 1.8 or the latest development version "
"should make that feature available.") "should make that feature available.")
...@@ -3786,7 +3786,7 @@ class TestAdvancedSubtensor(unittest.TestCase): ...@@ -3786,7 +3786,7 @@ class TestAdvancedSubtensor(unittest.TestCase):
[.5, .3 * 2, .15]]), aval [.5, .3 * 2, .15]]), aval
def test_inc_adv_selection_with_broadcasting(self): def test_inc_adv_selection_with_broadcasting(self):
if not AdvancedIncSubtensor.increment_available: if inplace_increment is None:
raise SkipTest("inc_subtensor with advanced indexing not enabled. " raise SkipTest("inc_subtensor with advanced indexing not enabled. "
"Installing NumPy 1.8 or the latest development version " "Installing NumPy 1.8 or the latest development version "
"should make that feature available.") "should make that feature available.")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论