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

docString for numpy.amin #586

Merged
merged 5 commits into from
Jul 23, 2023
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
31 changes: 31 additions & 0 deletions keras_core/ops/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,37 @@ def compute_output_spec(self, x):

@keras_core_export(["keras_core.ops.amin", "keras_core.ops.numpy.amin"])
def amin(x, axis=None, keepdims=False):
"""Returns the minimum of an array or minimum value along an axis.

Args:
x: Input tensor.
axis: Axis along which to compute the minimum.
By default (`axis=None`), find the minimum value in all the
dimensions of the input array.
keep_dims: If `True`, axes which are reduced are left in the result as
dimensions that are broadcast to the size of the original
input tensor. Defaults to `False`.

Returns:
An array with the minimum value. If `axis=None`, the result is a scalar
value representing the minimum element in the entire array. If `axis` is
given, the result is an array with the minimum values along
the specified axis.

Examples:

>>> x = keras_core.ops.convert_to_tensor([1, 3, 5, 2, 3, 6])
>>> keras_core.ops.amin(x)
array(1, dtype=int32)

>>> x = keras_core.ops.convert_to_tensor([[1, 6, 8], [7, 5, 3]])
>>> keras_core.ops.amin(x, axis=0)
array([1,5,3], dtype=int32)

>>> x = keras_core.ops.convert_to_tensor([[1, 6, 8], [7, 5, 3]])
>>> keras_core.ops.amin(x, axis=1, keepdims=True)
array([[1],[3]], dtype=int32)
"""
if any_symbolic_tensors((x,)):
return Amin(axis=axis, keepdims=keepdims).symbolic_call(x)
return backend.numpy.amin(x, axis=axis, keepdims=keepdims)
Expand Down