Skip to content

Commit

Permalink
Check to ensure no duplicate indices in Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
hunse authored and tbekolay committed Oct 6, 2017
1 parent e70abc4 commit 899f217
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nengo_ocl/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,13 @@ def plan_Copy(self, ops, legacy=False):
plans.append(plan_copy(self.queue, X, Y, incs))

if ops:
dupl = lambda s: (
s is not None
and not (isinstance(s, np.ndarray) and s.dtype == np.bool)
and len(s) != len(set(s)))
if any(dupl(op.src_slice) or dupl(op.dst_slice) for op in ops):
raise NotImplementedError("Duplicates in indices")

X = self.all_data[[self.sidx[op.src] for op in ops]]
Y = self.all_data[[self.sidx[op.dst] for op in ops]]
inds = lambda ary, i: np.arange(ary.size, dtype=np.int32)[
Expand Down

0 comments on commit 899f217

Please sign in to comment.