<s> import unittest <EOL> import cupy <EOL> from cupy import cuda <EOL> from cupy import testing <EOL> import numpy <EOL> from numpy import testing as np_testing <EOL> @ testing . gpu <EOL> class TestArrayGet ( unittest . TestCase ) : <EOL> _multiprocess_can_split_ = True <EOL> def setUp ( self ) : <EOL> self . stream = cuda . Stream ( ) <EOL> def check_get ( self , f , stream ) : <EOL> a_gpu = f ( cupy ) <EOL> a_cpu = f ( numpy ) <EOL> np_testing . assert_array_equal ( a_gpu . get ( stream ) , a_cpu ) <EOL> @ testing . for_all_dtypes ( ) <EOL> def test_contiguous_array ( self , dtype ) : <EOL> def contiguous_array ( xp ) : <EOL> return testing . shaped_arange ( ( <NUM_LIT:3> , ) , xp = xp , dtype = dtype ) <EOL> self . check_get ( contiguous_array , None ) <EOL> @ testing . for_all_dtypes ( ) <EOL> def test_non_contiguous_array ( self , dtype ) : <EOL> def non_contiguous_array ( xp ) : <EOL> return testing . shaped_arange ( ( <NUM_LIT:3> , ) , xp = xp , dtype = dtype ) [ <NUM_LIT:0> : : <NUM_LIT:2> ] <EOL> self . check_get ( non_contiguous_array , None ) <EOL> @ testing . for_all_dtypes ( ) <EOL> def test_contiguous_array_stream ( self , dtype ) : <EOL> def contiguous_array ( xp ) : <EOL> return testing . shaped_arange ( ( <NUM_LIT:3> , ) , xp = xp , dtype = dtype ) <EOL> self . check_get ( contiguous_array , self . stream . ptr ) <EOL> @ testing . for_all_dtypes ( ) <EOL> def test_non_contiguous_array_stream ( self , dtype ) : <EOL> def non_contiguous_array ( xp ) : <EOL> return testing . shaped_arange ( ( <NUM_LIT:3> , ) , xp = xp , dtype = dtype ) [ <NUM_LIT:0> : : <NUM_LIT:2> ] <EOL> self . check_get ( non_contiguous_array , self . stream . ptr ) </s>
