nested_indices_where

ivy.nested_indices_where(nest: Iterable, fn: Callable, check_nests: bool = False, _index: Optional[List] = None, _base: bool = True) → Union[Iterable, bool][source]

Checks the leaf nodes of nested x via function fn, and returns all nest indices where the method evaluates as True.

Parameters
  • nest (nest of any) – The nest to check the leaves of.

  • fn (callable) – The conditon function, returning True or False.

  • check_nests (bool, optional) – Whether to also check the nests for the condition, not only nest leaves. Default is False.

  • _index (list of tuples of indices, do not set) – The indices detected so far. None at the beginning. Used internally, do not set manually.

  • _base (bool, do not set) – Whether the current function call is the first function call in the recursive stack. Used internally, do not set manually.

Returns

A set of indices for the nest where the function evaluated as True.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty