neuralib.util.segments.foreach_map

neuralib.util.segments.foreach_map(v, f, indices_or_sections)[source]

Map function f into vector v in given sections.

Parameters:
  • v (ndarray) – Input 1d array

  • f (Callable[[ndarray], ndarray]) – Function to apply to each segment

  • indices_or_sections (ndarray) – If indices_or_sections is an integer, N, the array will be divided into N equal arrays along axis. If such a split is not possible, an error is raised

Returns:

Return type:

ndarray