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

Function _get_edges

numpy/lib/_arraypad_impl.py:155–184  ·  view source on GitHub ↗

Retrieve edge values from empty-padded array in given dimension. Parameters ---------- padded : ndarray Empty-padded array. axis : int Dimension in which the edges are considered. width_pair : (int, int) Pair of widths that mark the pad area on both

(padded, axis, width_pair)

Source from the content-addressed store, hash-verified

153
154
155def _get_edges(padded, axis, width_pair):
156 """
157 Retrieve edge values from empty-padded array in given dimension.
158
159 Parameters
160 ----------
161 padded : ndarray
162 Empty-padded array.
163 axis : int
164 Dimension in which the edges are considered.
165 width_pair : (int, int)
166 Pair of widths that mark the pad area on both sides in the given
167 dimension.
168
169 Returns
170 -------
171 left_edge, right_edge : ndarray
172 Edge values of the valid area in `padded` in the given dimension. Its
173 shape will always match `padded` except for the dimension given by
174 `axis` which will have a length of 1.
175 """
176 left_index = width_pair[0]
177 left_slice = _slice_at_axis(slice(left_index, left_index + 1), axis)
178 left_edge = padded[left_slice]
179
180 right_index = padded.shape[axis] - width_pair[1]
181 right_slice = _slice_at_axis(slice(right_index - 1, right_index), axis)
182 right_edge = padded[right_slice]
183
184 return left_edge, right_edge
185
186
187def _get_linear_ramps(padded, axis, width_pair, end_value_pair):

Callers 2

_get_linear_rampsFunction · 0.85
padFunction · 0.85

Calls 2

_slice_at_axisFunction · 0.85
sliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…