提交 6f3970eb authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #3148 from harlouci/props_sparse

Props sparse
差异被折叠。
...@@ -65,6 +65,8 @@ class AddSD_ccode(gof.op.Op): ...@@ -65,6 +65,8 @@ class AddSD_ccode(gof.op.Op):
:note: The grad implemented is structured on `x`. :note: The grad implemented is structured on `x`.
""" """
__props__ = ("format", "inplace")
def __init__(self, format, inplace=False, *args, **kwargs): def __init__(self, format, inplace=False, *args, **kwargs):
gof.Op.__init__(self, *args, **kwargs) gof.Op.__init__(self, *args, **kwargs)
# Should we do inplace addition or not ? # Should we do inplace addition or not ?
...@@ -73,14 +75,6 @@ class AddSD_ccode(gof.op.Op): ...@@ -73,14 +75,6 @@ class AddSD_ccode(gof.op.Op):
if self.inplace: if self.inplace:
self.destroy_map = {0: [3]} self.destroy_map = {0: [3]}
def __eq__(self, other):
return (type(self) == type(other) and
self.inplace == other.inplace and
self.format == other.format)
def __hash__(self):
return hash(type(self)) ^ hash(self.inplace) ^ hash(self.format)
def __str__(self): def __str__(self):
inp = '' inp = ''
if self.inplace: if self.inplace:
...@@ -224,15 +218,7 @@ class StructuredDotCSC(gof.Op): ...@@ -224,15 +218,7 @@ class StructuredDotCSC(gof.Op):
:note: The grad implemented is structured. :note: The grad implemented is structured.
:note: This op is used as an optimization for StructuredDot. :note: This op is used as an optimization for StructuredDot.
""" """
__props__ = ()
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, a_val, a_ind, a_ptr, a_nrows, b): def make_node(self, a_val, a_ind, a_ptr, a_nrows, b):
dtype_out = scalar.upcast(a_val.type.dtype, b.type.dtype) dtype_out = scalar.upcast(a_val.type.dtype, b.type.dtype)
...@@ -418,15 +404,7 @@ class StructuredDotCSR(gof.Op): ...@@ -418,15 +404,7 @@ class StructuredDotCSR(gof.Op):
:note: The grad implemented is structured. :note: The grad implemented is structured.
:note: This op is used as an optimization for StructuredDot. :note: This op is used as an optimization for StructuredDot.
""" """
__props__ = ()
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, a_val, a_ind, a_ptr, b): def make_node(self, a_val, a_ind, a_ptr, b):
self.dtype_out = scalar.upcast(a_val.type.dtype, b.type.dtype) self.dtype_out = scalar.upcast(a_val.type.dtype, b.type.dtype)
...@@ -604,6 +582,7 @@ class UsmmCscDense(gof.Op): ...@@ -604,6 +582,7 @@ class UsmmCscDense(gof.Op):
:note: Optimized version os Usmm when `x` is in csc format and :note: Optimized version os Usmm when `x` is in csc format and
`y` is dense. `y` is dense.
""" """
__props__ = ("inplace",)
def __init__(self, inplace): def __init__(self, inplace):
self.inplace = inplace self.inplace = inplace
...@@ -616,12 +595,6 @@ class UsmmCscDense(gof.Op): ...@@ -616,12 +595,6 @@ class UsmmCscDense(gof.Op):
else: else:
return 'UsmmCscDense{no_inplace}' return 'UsmmCscDense{no_inplace}'
def __eq__(self, other):
return (type(self) == type(other)) and self.inplace == other.inplace
def __hash__(self):
return hash(type(self)) ^ self.inplace
def make_node(self, alpha, x_val, x_ind, x_ptr, x_nrows, y, z): def make_node(self, alpha, x_val, x_ind, x_ptr, x_nrows, y, z):
alpha = tensor.as_tensor_variable(alpha) alpha = tensor.as_tensor_variable(alpha)
x_val = tensor.as_tensor_variable(x_val) x_val = tensor.as_tensor_variable(x_val)
...@@ -890,14 +863,8 @@ register_specialize(local_usmm_csx, 'cxx_only') ...@@ -890,14 +863,8 @@ register_specialize(local_usmm_csx, 'cxx_only')
class CSMGradC(gof.Op): class CSMGradC(gof.Op):
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self): __props__ = ()
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, a_val, a_ind, a_ptr, a_dim, def make_node(self, a_val, a_ind, a_ptr, a_dim,
b_val, b_ind, b_ptr, b_dim): b_val, b_ind, b_ptr, b_dim):
...@@ -1045,12 +1012,7 @@ class MulSDCSC(gof.Op): ...@@ -1045,12 +1012,7 @@ class MulSDCSC(gof.Op):
cannot be a complex type. cannot be a complex type.
:note: This op is used as an optimization of mul_s_d. :note: This op is used as an optimization of mul_s_d.
""" """
__props__ = ()
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self):
return hash(type(self))
def make_node(self, a_data, a_indices, a_indptr, b): def make_node(self, a_data, a_indices, a_indptr, b):
assert b.type.ndim == 2 assert b.type.ndim == 2
...@@ -1162,12 +1124,7 @@ class MulSDCSR(gof.Op): ...@@ -1162,12 +1124,7 @@ class MulSDCSR(gof.Op):
cannot be a complex type. cannot be a complex type.
:note: This op is used as an optimization of mul_s_d. :note: This op is used as an optimization of mul_s_d.
""" """
__props__ = ()
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self):
return hash(type(self))
def make_node(self, a_data, a_indices, a_indptr, b): def make_node(self, a_data, a_indices, a_indptr, b):
assert b.type.ndim == 2 assert b.type.ndim == 2
...@@ -1321,12 +1278,7 @@ class MulSVCSR(gof.Op): ...@@ -1321,12 +1278,7 @@ class MulSVCSR(gof.Op):
cannot be a complex type. cannot be a complex type.
:note: This op is used as an optimization of MulSV. :note: This op is used as an optimization of MulSV.
""" """
__props__ = ()
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self):
return hash(type(self))
def make_node(self, a_data, a_indices, a_indptr, b): def make_node(self, a_data, a_indices, a_indptr, b):
assert b.type.ndim == 1 assert b.type.ndim == 1
...@@ -1464,12 +1416,7 @@ class StructuredAddSVCSR(gof.Op): ...@@ -1464,12 +1416,7 @@ class StructuredAddSVCSR(gof.Op):
format. format.
:note: This op is used as an optimization for StructuredAddSV. :note: This op is used as an optimization for StructuredAddSV.
""" """
__props__ = ()
def __eq__(self, other):
return (type(self) == type(other))
def __hash__(self):
return hash(type(self))
def make_node(self, a_data, a_indices, a_indptr, b): def make_node(self, a_data, a_indices, a_indptr, b):
b = tensor.as_tensor_variable(b) b = tensor.as_tensor_variable(b)
...@@ -1638,15 +1585,7 @@ class SamplingDotCSR(gof.Op): ...@@ -1638,15 +1585,7 @@ class SamplingDotCSR(gof.Op):
allow mixed dtype. allow mixed dtype.
:note: This op is used as an optimization for SamplingDot. :note: This op is used as an optimization for SamplingDot.
""" """
__props__ = ()
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self):
return 'SamplingDot{Csr}'
def make_node(self, x, y, p_data, p_ind, p_ptr, p_ncols): def make_node(self, x, y, p_data, p_ind, p_ptr, p_ncols):
x = tensor.as_tensor_variable(x) x = tensor.as_tensor_variable(x)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论