MCPcopy Index your code
hub / github.com/numpy/numpy / _view_roi

Function _view_roi

numpy/lib/_arraypad_impl.py:59–84  ·  view source on GitHub ↗

Get a view of the current region of interest during iterative padding. When padding multiple dimensions iteratively corner values are unnecessarily overwritten multiple times. This function reduces the working area for the first dimensions so that corners are excluded. Paramet

(array, original_area_slice, axis)

Source from the content-addressed store, hash-verified

57
58
59def _view_roi(array, original_area_slice, axis):
60 """
61 Get a view of the current region of interest during iterative padding.
62
63 When padding multiple dimensions iteratively corner values are
64 unnecessarily overwritten multiple times. This function reduces the
65 working area for the first dimensions so that corners are excluded.
66
67 Parameters
68 ----------
69 array : ndarray
70 The array with the region of interest.
71 original_area_slice : tuple of slices
72 Denotes the area with original values of the unpadded array.
73 axis : int
74 The currently padded dimension assuming that `axis` is padded before
75 `axis` + 1.
76
77 Returns
78 -------
79 roi : ndarray
80 The region of interest of the original `array`.
81 """
82 axis += 1
83 sl = (slice(None),) * axis + original_area_slice[axis:]
84 return array[sl]
85
86
87def _pad_simple(array, pad_width, fill_value=None):

Callers 1

padFunction · 0.85

Calls 1

sliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…