提交 1d07f91b authored 作者: Iban Harlouchet's avatar Iban Harlouchet

__props__ for theano/tensor/nlinalg.py

上级 a622f3b2
...@@ -136,11 +136,8 @@ class AllocDiag(Op): ...@@ -136,11 +136,8 @@ class AllocDiag(Op):
""" """
Allocates a square matrix with the given vector as its diagonal. Allocates a square matrix with the given vector as its diagonal.
""" """
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self): __props__ = ()
return hash(type(self))
def make_node(self, _x): def make_node(self, _x):
x = as_tensor_variable(_x) x = as_tensor_variable(_x)
...@@ -170,17 +167,13 @@ class ExtractDiag(Op): ...@@ -170,17 +167,13 @@ class ExtractDiag(Op):
:note: work on the GPU. :note: work on the GPU.
""" """
__props__ = ("view",)
def __init__(self, view=False): def __init__(self, view=False):
self.view = view self.view = view
if self.view: if self.view:
self.view_map = {0: [0]} self.view_map = {0: [0]}
def __eq__(self, other):
return type(self) == type(other) and self.view == other.view
def __hash__(self):
return hash(type(self)) ^ hash(self.view)
def make_node(self, _x): def make_node(self, _x):
if not isinstance(_x, theano.Variable): if not isinstance(_x, theano.Variable):
x = as_tensor_variable(_x) x = as_tensor_variable(_x)
...@@ -262,6 +255,9 @@ class Det(Op): ...@@ -262,6 +255,9 @@ class Det(Op):
"""Matrix determinant """Matrix determinant
Input should be a square matrix Input should be a square matrix
""" """
__props__ = ()
def make_node(self, x): def make_node(self, x):
x = as_tensor_variable(x) x = as_tensor_variable(x)
assert x.ndim == 2 assert x.ndim == 2
...@@ -640,14 +636,8 @@ def svd(a, full_matrices=1, compute_uv=1): ...@@ -640,14 +636,8 @@ def svd(a, full_matrices=1, compute_uv=1):
class lstsq(Op): class lstsq(Op):
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self): __props__ = ()
return self.__class__.__name__
def make_node(self, x, y, rcond): def make_node(self, x, y, rcond):
x = theano.tensor.as_tensor_variable(x) x = theano.tensor.as_tensor_variable(x)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论