提交 f2e3c8d7 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make AllocEmpty return constant-valued memory under DebugMode so that it won't trip up checks.

上级 27ee5379
......@@ -3682,6 +3682,13 @@ class GpuAllocEmpty(GpuOp):
output.type.filter_checks_isfinite = False
return Apply(self, shape, [output])
def debug_perform(self, node, inputs, out_):
self.perform(self, node, inputs, out_)
# __setitem__ is limited on CudaNdarray
tmp = numpy.empty(out_[0][0].shape, dtype='float32')
tmp.fill(-123456789)
out_[0][0][:] = tmp
def perform(self, node, inputs, out_):
out, = out_
sh = tuple([int(i) for i in inputs])
......
......@@ -723,6 +723,10 @@ class GpuAllocEmpty(HideC, Alloc):
output.type.filter_checks_isfinite = False
return Apply(self, sh, [output])
def debug_perform(self, node, inputs, out_, ctx):
self.perform(node, inputs, out_, ctx)
out_[0][0][:] = -123456789
def perform(self, node, inputs, out_, ctx):
out = out_[0]
sh = [int(i) for i in inputs]
......
......@@ -6240,6 +6240,10 @@ class AllocEmpty(gof.Op):
output.type.filter_checks_isfinite = False
return Apply(self, shape, [output])
def debug_perform(self, node, inputs, out_):
self.perform(node, inputs, out_)
out_[0][0].fill(-123456789)
def perform(self, node, inputs, out_):
out, = out_
sh = tuple([int(i) for i in inputs])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论