提交 14b10a62 authored 作者: Frederic's avatar Frederic

Fix unpickling of Elemwise op since openmp changes.

上级 027566e1
...@@ -805,6 +805,12 @@ class OpenMPOp(Op): ...@@ -805,6 +805,12 @@ class OpenMPOp(Op):
openmp = theano.config.openmp openmp = theano.config.openmp
self.openmp = openmp self.openmp = openmp
def __setstate__(self, d):
self.__dict__.update(d)
# If we unpickle old op
if not hasattr(self, "openmp"):
self.openmp = False
def c_compile_args(self): def c_compile_args(self):
self.update_self_openmp() self.update_self_openmp()
if self.openmp: if self.openmp:
......
...@@ -498,7 +498,7 @@ class Elemwise(OpenMPOp): ...@@ -498,7 +498,7 @@ class Elemwise(OpenMPOp):
return d return d
def __setstate__(self, d): def __setstate__(self, d):
self.__dict__.update(d) super(Elemwise, self).__setstate__(d)
self.ufunc = None self.ufunc = None
self.nfunc = None self.nfunc = None
if getattr(self, 'nfunc_spec', None): if getattr(self, 'nfunc_spec', None):
......
...@@ -547,9 +547,7 @@ class ConvOp(OpenMPOp): ...@@ -547,9 +547,7 @@ class ConvOp(OpenMPOp):
return True return True
def __setstate__(self, d): def __setstate__(self, d):
self.__dict__.update(d) super(ConvOp, self).__setstate__(d)
if not hasattr(self, "openmp"):
self.openmp = False
self._rehash() self._rehash()
def _rehash(self): def _rehash(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论