提交 26bc5897 authored 作者: Pierre Luc Carrier's avatar Pierre Luc Carrier

Solved the issue of indexing a GpuArray by another GpuArray.

上级 ac2131f5
......@@ -392,6 +392,12 @@ class GpuAdvancedIncSubtensor1(tensor.AdvancedIncSubtensor1, Op):
# TODO opt to make this inplace
x, y, idx = inp
out, = out_
# Make sure idx is not a GpuArray otherwise we cannot use its content
# to index x and y
if isinstance(idx, gpuarray.GpuArray):
idx = numpy.asarray(idx)
if not self.inplace:
x = x.copy()
if self.set_instead_of_inc:
......@@ -399,11 +405,7 @@ class GpuAdvancedIncSubtensor1(tensor.AdvancedIncSubtensor1, Op):
if y.ndim == x.ndim:
assert len(y) == len(idx)
for (j, i) in enumerate(idx):
try:
x[i] = y[j]
except:
import pdb
pdb.set_trace()
else:
for i in idx:
x[i] = y
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论