提交 0a8c40bb authored 作者: Frederic's avatar Frederic

Fix test in DebugMode, the output is a numpy matrix, convert it to a numpy.ndarray

上级 b4da2292
...@@ -2683,10 +2683,10 @@ class __ComparisonOpSD(gof.op.Op): ...@@ -2683,10 +2683,10 @@ class __ComparisonOpSD(gof.op.Op):
x, y = as_sparse_variable(x), tensor.as_tensor_variable(y) x, y = as_sparse_variable(x), tensor.as_tensor_variable(y)
assert y.type.ndim == 2 assert y.type.ndim == 2
out = tensor.TensorType(dtype='uint8', broadcastable=(False, False))()
return gof.Apply(self, return gof.Apply(self,
[x, y], [x, y],
[SparseType(dtype='uint8', [out])
format=x.type.format)()])
def perform(self, node, inputs, outputs): def perform(self, node, inputs, outputs):
(x, y) = inputs (x, y) = inputs
...@@ -2694,7 +2694,9 @@ class __ComparisonOpSD(gof.op.Op): ...@@ -2694,7 +2694,9 @@ class __ComparisonOpSD(gof.op.Op):
assert _is_sparse(x) assert _is_sparse(x)
assert x.shape == y.shape assert x.shape == y.shape
assert _is_dense(y) assert _is_dense(y)
out[0] = self.comparison(x, y).astype('uint8') o = self.comparison(x, y).astype('uint8')
o = numpy.asarray(o)
out[0] = o
def infer_shape(self, node, ins_shapes): def infer_shape(self, node, ins_shapes):
return [ins_shapes[0]] return [ins_shapes[0]]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论