提交 13371bff authored 作者: Frederic Bastien's avatar Frederic Bastien

fix HostFromGpu.grad and GpuFromHost.grad return type. Probably the only impact…

fix HostFromGpu.grad and GpuFromHost.grad return type. Probably the only impact is to remove a warning.
上级 4ea6c9e8
...@@ -42,8 +42,7 @@ class HostFromGpu(Op): ...@@ -42,8 +42,7 @@ class HostFromGpu(Op):
def perform(self, node, (x,), (z,)): def perform(self, node, (x,), (z,)):
z[0] = numpy.asarray(x) z[0] = numpy.asarray(x)
def grad(self, inputs, (gz,)): def grad(self, inputs, (gz,)):
return gz, return [gpu_from_host(gz)]
#return [GpuFromHost()(gz)]
def infer_shape(self, node, xshp): def infer_shape(self, node, xshp):
return xshp return xshp
host_from_gpu = HostFromGpu() host_from_gpu = HostFromGpu()
...@@ -62,8 +61,7 @@ class GpuFromHost(Op): ...@@ -62,8 +61,7 @@ class GpuFromHost(Op):
def perform(self, node, (x,), (z,)): def perform(self, node, (x,), (z,)):
z[0] = type_support_filter(theano._asarray(x, dtype='float32'), tuple([0]*x.ndim), 0, z[0]) z[0] = type_support_filter(theano._asarray(x, dtype='float32'), tuple([0]*x.ndim), 0, z[0])
def grad(self, inputs, (gz,)): def grad(self, inputs, (gz,)):
return gz, return [host_from_gpu(gz)]
#return [HostFromGpu()(gz)]
def infer_shape(self, node, xshp): def infer_shape(self, node, xshp):
return xshp return xshp
gpu_from_host = GpuFromHost() gpu_from_host = GpuFromHost()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论