def METHOD_NAME(context: Context, args: Dict):
    default_args = {'img_to_float': True}
    img_to_float = args.get('img_to_float', default_args['img_to_float'])
    if img_to_float and (context.dtype is None or context.dtype != 'float32'):
        context.transforms.append({'type': 'CastFloat'})
        context.dtype = 'float32'
    context.transforms.append({'type': 'HWC2CHW'})
    return True