提交 f7cee63b authored 作者: Frederic's avatar Frederic

Don't copy the cached attribute.

上级 054d909c
import copy
import numpy import numpy
import theano import theano
...@@ -673,5 +675,12 @@ class TensorConstant(_tensor_py_operators, Constant): ...@@ -673,5 +675,12 @@ class TensorConstant(_tensor_py_operators, Constant):
other = theano.tensor.basic.constant(other) other = theano.tensor.basic.constant(other)
return (isinstance(other, TensorConstant) and return (isinstance(other, TensorConstant) and
self.signature() == other.signature()) self.signature() == other.signature())
def __copy__(self):
# We need to do this to remove the cached attribute
return type(self)(self.type, self.data, self.name)
def __deepcopy__(self, memo):
# We need to do this to remove the cached attribute
return type(self)(copy.copy(self.type), copy.copy(self.data), copy.copy(self.name))
TensorType.Constant = TensorConstant TensorType.Constant = TensorConstant
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论