Skip to content

Commit

Permalink
Merge df96e11 into 696632e
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaehashi committed Mar 15, 2018
2 parents 696632e + df96e11 commit fc90503
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cupy/manipulation/basic.py
Expand Up @@ -39,7 +39,7 @@ def copyto(dst, src, casting='same_kind', where=None):
if dst.size == 0:
return

if src_is_python_scalar:
if src_is_python_scalar and where is None:
dst.fill(src)
return

Expand Down
11 changes: 10 additions & 1 deletion tests/cupy_tests/manipulation_tests/test_basic.py
Expand Up @@ -108,7 +108,7 @@ def test_copyto_multigpu_noncontinguous(self, dtype):

@testing.parameterize(
*testing.product(
{'src': [float(3.2), int(0), int(4), int(-4), True, False],
{'src': [float(3.2), int(0), int(4), int(-4), True, False, 1+1j],
'dst_shape': [(), (0,), (1,), (1, 1), (2, 2)]}))
@testing.gpu
class TestCopytoFromScalar(unittest.TestCase):
Expand All @@ -119,3 +119,12 @@ def test_copyto(self, xp, dtype):
dst = xp.ones(self.dst_shape, dtype=dtype)
xp.copyto(dst, self.src)
return dst

@testing.for_all_dtypes()
@testing.numpy_cupy_allclose(accept_error=TypeError)
def test_copyto_where(self, xp, dtype):
dst = xp.ones(self.dst_shape, dtype=dtype)
mask = (testing.shaped_arange(
self.dst_shape, xp, dtype) % 2).astype(xp.bool_)
xp.copyto(dst, self.src, where=mask)
return dst

0 comments on commit fc90503

Please sign in to comment.