1- from __future__ import division
21import functools
32import sys
43import warnings
54
65import numpy
7- import six
86
7+ from cupy import _environment
98from cupy import _version
109
1110
11+ if sys .platform .startswith ('win32' ) and (3 , 8 ) <= sys .version_info : # NOQA
12+ _environment ._setup_win32_dll_directory () # NOQA
13+
14+
1215try :
1316 with warnings .catch_warnings ():
1417 warnings .filterwarnings ('ignore' , category = ImportWarning ,
1518 message = 'can\' t resolve package from __spec__' )
1619 from cupy import core # NOQA
17- except ImportError :
20+ except ImportError as e :
1821 # core is a c-extension module.
1922 # When a user cannot import core, it represents that CuPy is not correctly
2023 # built.
3437
3538original error: {}''' .format (exc_info [1 ])) # NOQA
3639
37- six . reraise ( ImportError , ImportError (msg ), exc_info [ 2 ])
40+ raise ImportError (msg ) from e
3841
3942
4043from cupy import cuda
@@ -59,7 +62,7 @@ def is_available():
5962from cupy import manipulation # NOQA
6063from cupy import padding # NOQA
6164from cupy import random # NOQA
62- from cupy import sorting # NOQA
65+ from cupy import _sorting # NOQA
6366from cupy import sparse # NOQA
6467from cupy import statistics # NOQA
6568from cupy import testing # NOQA # NOQA
@@ -498,12 +501,12 @@ def base_repr(number, base=2, padding=0): # NOQA (needed to avoid redefinition
498501from cupy .logic .truth import isin # NOQA
499502
500503
501- def isscalar (num ):
504+ def isscalar (element ):
502505 """Returns True if the type of num is a scalar type.
503506
504507 .. seealso:: :func:`numpy.isscalar`
505508 """
506- return numpy .isscalar (num )
509+ return numpy .isscalar (element )
507510
508511
509512from cupy .logic .ops import logical_and # NOQA
@@ -599,7 +602,8 @@ def isscalar(num):
599602from cupy .math .arithmetic import true_divide # NOQA
600603
601604from cupy .math .arithmetic import angle # NOQA
602- from cupy .math .arithmetic import conj # NOQA
605+ from cupy .math .arithmetic import conjugate as conj # NOQA
606+ from cupy .math .arithmetic import conjugate # NOQA
603607from cupy .math .arithmetic import imag # NOQA
604608from cupy .math .arithmetic import real # NOQA
605609
@@ -632,22 +636,23 @@ def isscalar(num):
632636# -----------------------------------------------------------------------------
633637# Sorting, searching, and counting
634638# -----------------------------------------------------------------------------
635- from cupy .sorting .count import count_nonzero # NOQA
636- from cupy .sorting .search import flatnonzero # NOQA
637- from cupy .sorting .search import nonzero # NOQA
639+ from cupy ._sorting .count import count_nonzero # NOQA
638640
639- from cupy .sorting .search import where # NOQA
640- from cupy .sorting .search import argmax # NOQA
641- from cupy .sorting .search import nanargmax # NOQA
642- from cupy .sorting .search import argmin # NOQA
643- from cupy .sorting .search import nanargmin # NOQA
641+ from cupy ._sorting .search import argmax # NOQA
642+ from cupy ._sorting .search import argmin # NOQA
643+ from cupy ._sorting .search import flatnonzero # NOQA
644+ from cupy ._sorting .search import nanargmax # NOQA
645+ from cupy ._sorting .search import nanargmin # NOQA
646+ from cupy ._sorting .search import nonzero # NOQA
647+ from cupy ._sorting .search import searchsorted # NOQA
648+ from cupy ._sorting .search import where # NOQA
644649
645- from cupy .sorting .sort import argpartition # NOQA
646- from cupy .sorting .sort import argsort # NOQA
647- from cupy .sorting .sort import lexsort # NOQA
648- from cupy .sorting .sort import msort # NOQA
649- from cupy .sorting .sort import partition # NOQA
650- from cupy .sorting .sort import sort # NOQA
650+ from cupy ._sorting .sort import argpartition # NOQA
651+ from cupy ._sorting .sort import argsort # NOQA
652+ from cupy ._sorting .sort import lexsort # NOQA
653+ from cupy ._sorting .sort import msort # NOQA
654+ from cupy ._sorting .sort import partition # NOQA
655+ from cupy ._sorting .sort import sort # NOQA
651656
652657# -----------------------------------------------------------------------------
653658# Statistics
@@ -662,6 +667,7 @@ def isscalar(num):
662667from cupy .statistics .order import nanmax # NOQA
663668from cupy .statistics .order import nanmin # NOQA
664669from cupy .statistics .order import percentile # NOQA
670+ from cupy .statistics .order import ptp # NOQA
665671
666672from cupy .statistics .meanvar import average # NOQA
667673from cupy .statistics .meanvar import mean # NOQA
@@ -672,6 +678,7 @@ def isscalar(num):
672678from cupy .statistics .meanvar import nanvar # NOQA
673679
674680from cupy .statistics .histogram import bincount # NOQA
681+ from cupy .statistics .histogram import digitize # NOQA
675682from cupy .statistics .histogram import histogram # NOQA
676683
677684# -----------------------------------------------------------------------------
@@ -689,7 +696,7 @@ def isscalar(num):
689696from cupy .core import ElementwiseKernel # NOQA
690697from cupy .core import RawKernel # NOQA
691698from cupy .core import RawModule # NOQA
692- from cupy .core import ReductionKernel # NOQA
699+ from cupy .core . _reduction import ReductionKernel # NOQA
693700
694701# -----------------------------------------------------------------------------
695702# DLPack
@@ -805,18 +812,3 @@ def show_config():
805812 """Prints the current runtime configuration to standard output."""
806813 sys .stdout .write (str (_cupyx .get_runtime_info ()))
807814 sys .stdout .flush ()
808-
809-
810- # -----------------------------------------------------------------------------
811- # Warning for Python 2 users
812- # -----------------------------------------------------------------------------
813- if sys .version_info [:1 ] == (2 ,):
814- warnings .warn ('''
815- --------------------------------------------------------------------------------
816- CuPy is going to stop supporting Python 2 in v7.x releases.
817-
818- Future releases of CuPy v7.x will not run on Python 2.
819- If you need to continue using Python 2, consider using CuPy v6.x, which
820- will be the last version that runs on Python 2.
821- --------------------------------------------------------------------------------
822- ''' ) # NOQA
0 commit comments