提交 bb572061 authored 作者: abergeron's avatar abergeron

Merge pull request #1928 from nouiz/scan_crash

Scan crash
...@@ -1630,7 +1630,7 @@ class _Linker(gof.link.LocalLinker): ...@@ -1630,7 +1630,7 @@ class _Linker(gof.link.LocalLinker):
thunks_py.append(None) thunks_py.append(None)
# If the op define its own make_thunk, check it # If the op define its own make_thunk, check it
if node.op.make_thunk.im_func not in default_make_thunk: if get_unbound_function(node.op.make_thunk) not in default_make_thunk:
compute_map = {} compute_map = {}
for k in node.inputs: for k in node.inputs:
compute_map[k] = [True] compute_map[k] = [True]
......
...@@ -236,7 +236,7 @@ class GpuOp(theano.gof.Op): ...@@ -236,7 +236,7 @@ class GpuOp(theano.gof.Op):
compute_map, no_recycling) compute_map, no_recycling)
theano.compile.debugmode.default_make_thunk.append( theano.compile.debugmode.default_make_thunk.append(
get_unbound_function(GpuOp.make_thunk)) get_unbound_function(GpuOp.make_thunk))
# We must do those import to be able to create the full doc when # We must do those import to be able to create the full doc when
# nvcc is not available # nvcc is not available
......
...@@ -448,9 +448,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None): ...@@ -448,9 +448,7 @@ def equal_computations(xs, ys, in_xs=None, in_ys=None):
if dx != dy: if dx != dy:
if (isinstance(dx, tensor.Constant) and if (isinstance(dx, tensor.Constant) and
isinstance(dy, tensor.Constant)): isinstance(dy, tensor.Constant)):
if not (numpy.all(dx.data == dy.data) and if not dx.equals(dy):
dx.type.dtype == dy.type.dtype and
dx.data.shape == dy.data.shape):
return False return False
else: else:
pass pass
......
...@@ -373,11 +373,11 @@ class _tensor_py_operators: ...@@ -373,11 +373,11 @@ class _tensor_py_operators:
and all(a == slice(None) for a in args[:axis]) and all(a == slice(None) for a in args[:axis])
and all(a == slice(None) for a in args[axis + 1:]) and all(a == slice(None) for a in args[axis + 1:])
and isinstance(args[axis], ( and isinstance(args[axis], (
numpy.ndarray, numpy.ndarray,
list, list,
TensorVariable, TensorVariable,
TensorConstant, TensorConstant,
theano.tensor.sharedvar.TensorSharedVariable))): theano.tensor.sharedvar.TensorSharedVariable))):
return self.take(arg, axis) return self.take(arg, axis)
else: else:
return theano.tensor.subtensor.advanced_subtensor(self, *args) return theano.tensor.subtensor.advanced_subtensor(self, *args)
...@@ -405,8 +405,9 @@ class _tensor_py_operators: ...@@ -405,8 +405,9 @@ class _tensor_py_operators:
return rval return rval
else: else:
return theano.tensor.subtensor.Subtensor(args)( return theano.tensor.subtensor.Subtensor(args)(
self, *theano.tensor.subtensor.Subtensor.collapse(args, self, *theano.tensor.subtensor.Subtensor.collapse(
lambda entry: isinstance(entry, Variable))) args,
lambda entry: isinstance(entry, Variable)))
def take(self, indices, axis=None, mode='raise'): def take(self, indices, axis=None, mode='raise'):
return theano.tensor.subtensor.take(self, indices, axis, mode) return theano.tensor.subtensor.take(self, indices, axis, mode)
...@@ -701,6 +702,7 @@ class TensorConstant(_tensor_py_operators, Constant): ...@@ -701,6 +702,7 @@ 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): def __copy__(self):
# We need to do this to remove the cached attribute # We need to do this to remove the cached attribute
return type(self)(self.type, self.data, self.name) return type(self)(self.type, self.data, self.name)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论