Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add precision only arguments #2850

Merged
merged 2 commits into from
Apr 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions jax/numpy/lax_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,12 +747,12 @@ def _conv(x, y, mode, op, precision):


@_wraps(onp.convolve, lax_description=_PRECISION_DOC)
def convolve(x, y, mode='full', precision=None):
def convolve(x, y, mode='full', *, precision=None):
return _conv(x, y, mode, 'convolve', precision)


@_wraps(onp.correlate, lax_description=_PRECISION_DOC)
def correlate(x, y, mode='valid', precision=None):
def correlate(x, y, mode='valid', *, precision=None):
return _conv(x, y, mode, 'correlate', precision)


Expand Down Expand Up @@ -2482,7 +2482,7 @@ def append(arr, values, axis=None):


@_wraps(onp.dot, lax_description=_PRECISION_DOC)
def dot(a, b, precision=None): # pylint: disable=missing-docstring
def dot(a, b, *, precision=None): # pylint: disable=missing-docstring
_check_arraylike("dot", a, b)
a, b = _promote_dtypes(a, b)
a_ndim, b_ndim = ndim(a), ndim(b)
Expand All @@ -2500,7 +2500,7 @@ def dot(a, b, precision=None): # pylint: disable=missing-docstring


@_wraps(onp.matmul, lax_description=_PRECISION_DOC)
def matmul(a, b, precision=None): # pylint: disable=missing-docstring
def matmul(a, b, *, precision=None): # pylint: disable=missing-docstring
_check_arraylike("matmul", a, b)
a_is_vec, b_is_vec = (ndim(a) == 1), (ndim(b) == 1)
a = lax.reshape(a, (1,) + shape(a)) if a_is_vec else a
Expand All @@ -2524,14 +2524,14 @@ def matmul(a, b, precision=None): # pylint: disable=missing-docstring


@_wraps(onp.vdot, lax_description=_PRECISION_DOC)
def vdot(a, b, precision=None):
def vdot(a, b, *, precision=None):
if issubdtype(_dtype(a), complexfloating):
a = conj(a)
return dot(a.ravel(), b.ravel(), precision=precision)


@_wraps(onp.tensordot, lax_description=_PRECISION_DOC)
def tensordot(a, b, axes=2, precision=None):
def tensordot(a, b, axes=2, *, precision=None):
_check_arraylike("tensordot", a, b)
a_ndim = ndim(a)
b_ndim = ndim(b)
Expand Down Expand Up @@ -2731,7 +2731,7 @@ def _movechars(s, src, dst):


@_wraps(onp.inner, lax_description=_PRECISION_DOC)
def inner(a, b, precision=None):
def inner(a, b, *, precision=None):
if ndim(a) == 0 or ndim(b) == 0:
return a * b
return tensordot(a, b, (-1, -1), precision=precision)
Expand Down