Repository: ivy-llc/ivy

Issue:
general



Discussion:

Resolving patch:
diff --git a/ivy/data_classes/array/general.py b/ivy/data_classes/array/general.py
--- a/ivy/data_classes/array/general.py
+++ b/ivy/data_classes/array/general.py
@@ -250,13 +250,12 @@ def gather(
         --------
         >>> x = ivy.array([0., 1., 2.])
         >>> y = ivy.array([0, 1])
-        >>> x.gather(y)
+        >>> gather = x.gather(y)
+        >>> print(gather)
         ivy.array([0., 1.])
 
         """
-        return ivy.gather(
-            self._data, indices, axis=axis, batch_dims=batch_dims, out=out
-        )
+        return ivy.gather(self, indices, axis=axis, batch_dims=batch_dims, out=out)
 
     def scatter_nd(
         self: ivy.Array,
@@ -332,6 +331,8 @@ def gather_nd(
             The array from which to gather values.
         indices
             Index array.
+        batch_dims
+            optional int, lets you gather different items from each element of a batch.
         out
             optional output array, for writing the result to. It must have a shape that
             the inputs broadcast to.
diff --git a/ivy/data_classes/container/general.py b/ivy/data_classes/container/general.py
--- a/ivy/data_classes/container/general.py
+++ b/ivy/data_classes/container/general.py
@@ -1489,7 +1489,8 @@ def static_gather(
         >>> x = ivy.Container(a = ivy.array([0., 1., 2.]),
         ...                   b = ivy.array([4., 5., 6.]))
         >>> y = ivy.array([0, 1])
-        >>> print(ivy.Container.static_gather(x, y))
+        >>> z = ivy.Container.static_gather(x, y)
+        >>> print(z)
         {
             a: ivy.array([0., 1.]),
             b: ivy.array([4., 5.])
@@ -1565,7 +1566,8 @@ def gather(
         ...                   b = ivy.array([4., 5., 6.]))
         >>> y = ivy.Container(a = ivy.array([0, 1]),
         ...                   b = ivy.array([1, 2]))
-        >>> print(x.gather(y))
+        >>> z = x.gather(y)
+        >>> print(z)
         {
             a: ivy.array([0., 1.]),
             b: ivy.array([5., 6.])
@@ -1605,6 +1607,17 @@ def static_has_nans(
             The container to check for nans.
         include_infs
             Whether to include infs and -infs in the check. Default is True.
+        key_chains
+            The key-chains to apply or not apply the method to. Default is ``None``.
+        to_apply
+            If True, the method will be applied to key_chains, otherwise key_chains
+            will be skipped. Default is ``True``.
+        prune_unapplied
+            Whether to prune key_chains for which the function was not applied.
+            Default is ``False``.
+        map_sequences
+            Whether to also map method to sequences (lists, tuples).
+            Default is ``False``.
 
         Returns
         -------
@@ -1613,7 +1626,7 @@ def static_has_nans(
 
         Examples
         --------
-        >>> x = ivy.container(a=ivy.array([1, 2]), b=ivy.array([float('nan'), 2]))
+        >>> x = ivy.Container(a=ivy.array([1, 2]), b=ivy.array([float('nan'), 2]))
         >>> y = ivy.Container.static_has_nans(x)
         >>> print(y)
         {
@@ -1649,6 +1662,17 @@ def has_nans(
         ----------
         include_infs
             Whether to include infs and -infs in the check. Default is True.
+        key_chains
+            The key-chains to apply or not apply the method to. Default is ``None``.
+        to_apply
+            If True, the method will be applied to key_chains, otherwise key_chains
+            will be skipped. Default is ``True``.
+        prune_unapplied
+            Whether to prune key_chains for which the function was not applied.
+            Default is ``False``.
+        map_sequences
+            Whether to also map method to sequences (lists, tuples).
+            Default is ``False``.
 
         Returns
         -------
@@ -1656,7 +1680,7 @@ def has_nans(
 
         Examples
         --------
-        >>> x = ivy.container(a=ivy.array([1, 2]), b=ivy.array([float('nan'), 2]))
+        >>> x = ivy.Container(a=ivy.array([1, 2]), b=ivy.array([float('nan'), 2]))
         >>> y = x.has_nans(x)
         >>> print(y)
         {
@@ -2026,8 +2050,12 @@ def static_gather_nd(
 
         Parameters
         ----------
+        params
+            The container from which to gather values.
         indices
             Index array.
+        batch_dims
+            optional int, lets you gather different items from each element of a batch.
         key_chains
             The key-chains to apply or not apply the method to. Default is ``None``.
         to_apply
@@ -2039,6 +2067,9 @@ def static_gather_nd(
         map_sequences
             Whether to also map method to sequences (lists, tuples).
             Default is ``False``.
+        out
+            optional array, for writing the result to. It must have a shape
+            that the inputs broadcast to.
 
         Returns
         -------
@@ -2093,6 +2124,8 @@ def gather_nd(
             The container from which to gather values.
         indices
             Index array or container.
+        batch_dims
+            optional int, lets you gather different items from each element of a batch.
         key_chains
             The key-chains to apply or not apply the method to. Default is ``None``.
         to_apply
@@ -2158,6 +2191,8 @@ def static_einops_reduce(
 
         Parameters
         ----------
+        x
+            input container.
         pattern
             Reduction pattern.
         reduction
@@ -2176,6 +2211,9 @@ def static_einops_reduce(
             Default is ``False``.
         axes_lengths
             Any additional specifications for dimensions.
+        out
+            optional array, for writing the result to. It must have a shape
+            that the inputs broadcast to.
 
         Returns
         -------
@@ -2309,6 +2347,8 @@ def static_einops_repeat(
 
         Parameters
         ----------
+        x
+            input container.
         pattern
             Rearrangement pattern.
         key_chains
diff --git a/ivy/functional/ivy/general.py b/ivy/functional/ivy/general.py
--- a/ivy/functional/ivy/general.py
+++ b/ivy/functional/ivy/general.py
@@ -3172,7 +3172,11 @@ def gather(
 
     """
     return current_backend(params, indices).gather(
-        params, indices, axis=axis, batch_dims=batch_dims, out=out
+        params,
+        indices,
+        axis=axis,
+        batch_dims=batch_dims,
+        out=out
     )
 
 
@@ -3199,6 +3203,8 @@ def gather_nd(
         The array from which to gather values.
     indices
         Index array.
+    batch_dims
+        optional int, lets you gather different items from each element of a batch.
     out
         optional output array, for writing the result to. It must have a shape that the
         inputs broadcast to.


Test patch: