提交 3f66dba3 authored 作者: Frederic Bastien's avatar Frederic Bastien

make GpuFromHost return a dtype of the same dtype as the input. As CudaNdarray…

make GpuFromHost return a dtype of the same dtype as the input. As CudaNdarray support only float32, an error will be raised.
上级 106625e3
...@@ -60,7 +60,7 @@ class GpuFromHost(Op): ...@@ -60,7 +60,7 @@ class GpuFromHost(Op):
def make_node(self, x): def make_node(self, x):
if not isinstance(x.type, tensor.TensorType): if not isinstance(x.type, tensor.TensorType):
raise TypeError(x) raise TypeError(x)
return Apply(self, [x], [CudaNdarrayType(broadcastable=x.broadcastable)()]) return Apply(self, [x], [CudaNdarrayType(broadcastable=x.broadcastable, dtype=x.dtype)()])
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,)):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论