code: def get_center_crop_torchvision_alike(
      image_height, image_width, output_size, img, out_buffer
  ):
      crop_height = output_size[0]
      crop_width = output_size[1]
  
      padding_h = (
          (crop_height - image_height) // 2
          if crop_height > image_height
          else 0
      )
      padding_w = (
          (crop_width - image_width) // 2
          if crop_width > image_width
          else 0
      )
  
      crop_t = (
          int(round((image_height - crop_height) / 2.0))
          if image_height > crop_height
          else 0
      )
      crop_l = (
          int(round((image_width - crop_width) / 2.0))
          if image_width > crop_width
          else 0
      )
      crop_height_effective = min(crop_height, image_height)
      crop_width_effective = min(crop_width, image_width)
  
      # print(image_height, image_width, crop_height, crop_width, padding_h, padding_w, crop_t, crop_l, crop_height_effective, crop_width_effective)
      # print(f'From ({crop_t} : {crop_t+crop_height_effective}, {crop_l} : {crop_l+crop_width_effective}) to '
      #       f'{padding_h} : {padding_h+crop_height_effective}, {padding_w} : {padding_w+crop_width_effective}')
  
      if (
          crop_height_effective != crop_height
          or crop_width_effective != crop_width
      ):
          out_buffer[:] = 0  # Set padding color
      out_buffer[
          padding_h : padding_h + crop_height_effective,
          padding_w : padding_w + crop_width_effective,
      ] = img[
          crop_t : crop_t + crop_height_effective,
          crop_l : crop_l + crop_width_effective,
      ]
  
      return out_buffer
  
file_path: avalanche/avalanche/benchmarks/utils/ffcv_support/center_crop.py
imports: from typing import Callable, Tuple
  from ffcv.fields.decoders import SimpleRGBImageDecoder
  from ffcv.pipeline.state import State
  from ffcv.pipeline.allocation_query import AllocationQuery
  import numpy
  from dataclasses import replace
  from ffcv.fields.rgb_image import IMAGE_MODES
  from ffcv.pipeline.compiler import Compiler
  from ffcv.libffcv import imdecode
label_desc: Use image node_id 1 for calling a global function with example usage: get_center_crop_torchvision_alike(image_height, image_width, output_size, img, out_buffer) and returns: out_buffer