提交 6d0734c7 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make sure not to transfer excessively between CPU and GPU.

上级 ce1d5d01
......@@ -242,7 +242,10 @@ class GpuArrayType(Type):
up_dtype = scalar.upcast(self.dtype, data.dtype)
if up_dtype == self.dtype:
data = numpy.array(data, dtype=self.dtype, copy=False)
if not isinstance(data, gpuarray.GpuArray):
data = numpy.array(data, dtype=self.dtype, copy=False)
else:
data = gpuarray.array(data, dtype=self.dtype, copy=False)
else:
raise TypeError("%s cannot store a value of dtype %s "
"without risking loss of precision." %
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论