code: def _get_view(padded, kernel_shape, idx, val):
      """Get a view into `padded` that is offset by `idx` and scaled by `val`.
  
      If `padded` was created by padding the original image by `kernel_shape` as
      in correlate_sparse, then the view created here will match the size of the
      original image.
      """
      sl_shift = tuple(
          [
              slice(c, s - (w_ - 1 - c))
              for c, w_, s in zip(idx, kernel_shape, padded.shape)
          ]
      )
      v = padded[sl_shift]
      if val == 1:
          return v
      return val * v
  
imports: import numpy
  from .._shared.utils import _supported_float_type, _to_np_mode
label_desc: Use image node_id 2 for calling a global function with example usage: _get_view(padded, kernel_shape, idx, val) and returns: unknown, v