Skip to content

Commit

Permalink
Merge branch 'master' into cudnn-ctc
Browse files Browse the repository at this point in the history
  • Loading branch information
aonotas committed Apr 5, 2019
2 parents d0cc91c + 7312c4d commit cb658d8
Show file tree
Hide file tree
Showing 222 changed files with 25,249 additions and 5,056 deletions.
2 changes: 1 addition & 1 deletion .flake8.cython
@@ -1,4 +1,4 @@
[flake8]
filename = *.pyx,*.px*
exclude = .eggs,*.egg,build,docs,.git
ignore = E225,E226,E227,E999
ignore = W503,W504,E225,E226,E227,E999
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,14 @@
Thank you for using and contributing to CuPy!

If your issue is a **request for support in using CuPy**, please post it on [Stack Overflow](https://stackoverflow.com/questions/tagged/cupy) or Google Groups ([en](https://groups.google.com/forum/#!forum/cupy) / [ja](https://groups.google.com/forum/#!forum/cupy-ja)).
Developer team members are monitoring questions on these channels.

If it is a bug report, please include the following information:

* Conditions (you can just paste the output of `python -c 'import cupy; cupy.show_config()'`)
- CuPy version
- OS/Platform
- CUDA version
- cuDNN/NCCL version (if applicable)
* Code to reproduce
* Error messages, stack traces, or logs
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -24,7 +24,7 @@ script:
- python -Werror::DeprecationWarning -Wignore::DeprecationWarning:site -m compileall -f -q cupy cupyx examples tests docs
- pip install scipy
- pushd docs
- make html
- SPHINXOPTS=-W make html
- popd

sudo: false
7 changes: 7 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,7 @@
# Chainer Code of Conduct

CuPy follows the [NumFOCUS Code of Conduct][homepage] available at https://numfocus.org/code-of-conduct.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at chainer@preferred.jp.

[homepage]: https://numfocus.org/
2 changes: 1 addition & 1 deletion MANIFEST.in
@@ -1,4 +1,4 @@
recursive-include cupy *.h
recursive-include cupy *.h *.hpp
recursive-exclude cupy *.pyx *.pxd *.pxi
include cupy_setup_build.py
recursive-include install *.py
Expand Down
5 changes: 4 additions & 1 deletion README.md
@@ -1,4 +1,4 @@
<div align="center"><img src="docs/image/cupy_logo_1000px.png" width="400"/></div>
<div align="center"><img src="https://raw.githubusercontent.com/cupy/cupy/master/docs/image/cupy_logo_1000px.png" width="400"/></div>

# CuPy : NumPy-like API accelerated with CUDA

Expand Down Expand Up @@ -38,6 +38,9 @@ $ pip install cupy-cuda91
(Binary Package for CUDA 9.2)
$ pip install cupy-cuda92

(Binary Package for CUDA 10.0)
$ pip install cupy-cuda100

(Source Package)
$ pip install cupy
```
Expand Down
18 changes: 13 additions & 5 deletions cupy/__init__.py
Expand Up @@ -58,6 +58,7 @@ def is_available():
from cupy import statistics # NOQA
from cupy import testing # NOQA # NOQA
from cupy import util # NOQA
from cupy import lib # NOQA


# import class and function
Expand Down Expand Up @@ -387,6 +388,8 @@ def binary_repr(num, width=None):
from cupy.indexing.indexing import diagonal # NOQA
from cupy.indexing.indexing import take # NOQA

from cupy.indexing.insert import place # NOQA
from cupy.indexing.insert import put # NOQA
from cupy.indexing.insert import fill_diagonal # NOQA
# -----------------------------------------------------------------------------
# Input and output
Expand Down Expand Up @@ -478,6 +481,7 @@ def isscalar(num):
from cupy.math.trigonometric import radians # NOQA
from cupy.math.trigonometric import sin # NOQA
from cupy.math.trigonometric import tan # NOQA
from cupy.math.trigonometric import unwrap # NOQA

from cupy.math.hyperbolic import arccosh # NOQA
from cupy.math.hyperbolic import arcsinh # NOQA
Expand All @@ -498,6 +502,7 @@ def isscalar(num):
from cupy.math.sumprod import sum # NOQA
from cupy.math.sumprod import cumprod # NOQA
from cupy.math.sumprod import cumsum # NOQA
from cupy.math.sumprod import diff # NOQA
from cupy.math.window import blackman # NOQA
from cupy.math.window import hamming # NOQA
from cupy.math.window import hanning # NOQA
Expand Down Expand Up @@ -627,7 +632,7 @@ def isscalar(num):
from cupy.ext.scatter import scatter_add # NOQA


def asnumpy(a, stream=None):
def asnumpy(a, stream=None, order='C'):
"""Returns an array on the host memory from an arbitrary source array.
Args:
Expand All @@ -636,15 +641,17 @@ def asnumpy(a, stream=None):
the device-to-host copy runs asynchronously. Otherwise, the copy is
synchronous. Note that if ``a`` is not a :class:`cupy.ndarray`
object, then this argument has no effect.
order ({'C', 'F', 'A'}): The desired memory layout of the host
array. When ``order`` is 'A', it uses 'F' if ``a`` is
fortran-contiguous and 'C' otherwise.
Returns:
numpy.ndarray: Converted array on the host memory.
"""
if isinstance(a, ndarray):
return a.get(stream=stream)
return a.get(stream=stream, order=order)
else:
return numpy.asarray(a)
return numpy.asarray(a, order=order)


_cupy = sys.modules[__name__]
Expand Down Expand Up @@ -675,7 +682,8 @@ def get_array_module(*args):
"""
for arg in args:
if isinstance(arg, (ndarray, sparse.spmatrix,
cupy.core.fusion.FusionVarPython)):
cupy.core.fusion._FusionVarScalar,
cupy.core.fusion._FusionVarArray)):
return _cupy
return numpy

Expand Down
2 changes: 1 addition & 1 deletion cupy/_version.py
@@ -1 +1 @@
__version__ = '6.0.0a1'
__version__ = '6.0.0rc1'
50 changes: 25 additions & 25 deletions cupy/core/__init__.py
Expand Up @@ -3,59 +3,59 @@


# import class and function
from cupy.core._errors import _AxisError # NOQA
from cupy.core._kernel import create_reduction_func # NOQA
from cupy.core._kernel import create_ufunc # NOQA
from cupy.core._kernel import ElementwiseKernel # NOQA
from cupy.core._kernel import ReductionKernel # NOQA
from cupy.core._kernel import ufunc # NOQA
from cupy.core.core import absolute # NOQA
from cupy.core.core import add # NOQA
from cupy.core.core import angle # NOQA
from cupy.core._routines_manipulation import array_split # NOQA
from cupy.core._routines_manipulation import broadcast # NOQA
from cupy.core._routines_manipulation import broadcast_to # NOQA
from cupy.core._routines_manipulation import concatenate_method # NOQA
from cupy.core._routines_manipulation import moveaxis # NOQA
from cupy.core._routines_manipulation import rollaxis # NOQA
from cupy.core._routines_manipulation import size # NOQA'
from cupy.core._routines_math import absolute # NOQA
from cupy.core._routines_math import add # NOQA
from cupy.core._routines_math import angle # NOQA
from cupy.core._routines_math import conj # NOQA
from cupy.core._routines_math import divide # NOQA
from cupy.core._routines_math import floor_divide # NOQA
from cupy.core._routines_math import imag # NOQA
from cupy.core._routines_math import multiply # NOQA
from cupy.core._routines_math import negative # NOQA
from cupy.core._routines_math import power # NOQA
from cupy.core._routines_math import real # NOQA
from cupy.core._routines_math import remainder # NOQA
from cupy.core._routines_math import sqrt # NOQA
from cupy.core._routines_math import subtract # NOQA
from cupy.core._routines_math import true_divide # NOQA
from cupy.core._routines_statistics import nanmax # NOQA
from cupy.core._routines_statistics import nanmin # NOQA
from cupy.core.core import array # NOQA
from cupy.core.core import array_split # NOQA
from cupy.core.core import ascontiguousarray # NOQA
from cupy.core.core import asfortranarray # NOQA
from cupy.core.core import bitwise_and # NOQA
from cupy.core.core import bitwise_or # NOQA
from cupy.core.core import bitwise_xor # NOQA
from cupy.core.core import broadcast # NOQA
from cupy.core.core import broadcast_to # NOQA
from cupy.core.core import concatenate_method # NOQA
from cupy.core.core import conj # NOQA
from cupy.core.core import create_comparison # NOQA
from cupy.core.core import divide # NOQA
from cupy.core.core import divmod # NOQA
from cupy.core.core import dot # NOQA
from cupy.core.core import elementwise_copy # NOQA
from cupy.core.core import elementwise_copy_where # NOQA
from cupy.core.core import equal # NOQA
from cupy.core.core import floor_divide # NOQA
from cupy.core.core import greater # NOQA
from cupy.core.core import greater_equal # NOQA
from cupy.core.core import imag # NOQA
from cupy.core.core import invert # NOQA
from cupy.core.core import left_shift # NOQA
from cupy.core.core import less # NOQA
from cupy.core.core import less_equal # NOQA
from cupy.core.core import matmul # NOQA
from cupy.core.core import moveaxis # NOQA
from cupy.core.core import multiply # NOQA
from cupy.core.core import nanmax # NOQA
from cupy.core.core import nanmin # NOQA
from cupy.core.core import ndarray # NOQA
from cupy.core.core import negative # NOQA
from cupy.core.core import normalize_axis_tuple # NOQA
from cupy.core.core import not_equal # NOQA
from cupy.core.core import power # NOQA
from cupy.core.core import real # NOQA
from cupy.core.core import remainder # NOQA
from cupy.core.core import right_shift # NOQA
from cupy.core.core import rollaxis # NOQA
from cupy.core.core import size # NOQA'
from cupy.core.core import sqrt # NOQA
from cupy.core.core import subtract # NOQA
from cupy.core.core import tensordot_core # NOQA
from cupy.core.core import true_divide # NOQA
from cupy.core.dlpack import fromDlpack # NOQA
from cupy.core.internal import complete_slice # NOQA
from cupy.core.internal import get_size # NOQA
Expand Down
4 changes: 2 additions & 2 deletions cupy/core/_dtype.pyx
Expand Up @@ -45,7 +45,7 @@ _init_dtype_dict()

@cython.profile(False)
cpdef get_dtype(t):
if isinstance(t, numpy.dtype):
if type(t) is numpy.dtype: # Exact type check
return t
ret = _dtype_dict.get(t, None)
if ret is None:
Expand All @@ -55,7 +55,7 @@ cpdef get_dtype(t):

@cython.profile(False)
cpdef tuple get_dtype_with_itemsize(t):
if isinstance(t, numpy.dtype):
if type(t) is numpy.dtype: # Exact type check
return t, t.itemsize
ret = _dtype_dict.get(t, None)
if ret is None:
Expand Down
12 changes: 12 additions & 0 deletions cupy/core/_errors.py
@@ -0,0 +1,12 @@
import numpy


try:
_AxisError = numpy.AxisError
except AttributeError:
class IndexOrValueError(IndexError, ValueError):

def __init__(self, *args, **kwargs):
super(IndexOrValueError, self).__init__(*args, **kwargs)

_AxisError = IndexOrValueError

0 comments on commit cb658d8

Please sign in to comment.