# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/docstrings.ipynb.

# %% auto 0
__all__ = ['CHANNELS_FIRST_DOC', 'CONFIG_INSTANCE_DOC', 'CONFIG_KWARGS_DOC', 'CHECKPOINTING_LEVEL_DOC', 'INPUT_1D_DOC',
           'INPUT_2D_DOC', 'INPUT_3D_DOC', 'OUTPUT_1D_DOC', 'OUTPUT_2D_DOC', 'OUTPUT_3D_DOC',
           'RELATIVE_POSITION_BIAS_DOC', 'LOGIT_SCALE_DOC', 'CLASS_DESCRIPTION_1D_DOC', 'CLASS_DESCRIPTION_2D_DOC',
           'CLASS_DESCRIPTION_3D_DOC', 'SPACINGS_DOC', 'RETURN_INTERMEDIATES_DOC', 'BOUNDING_BOXES_FORMAT_DOC',
           'populate_docstring']

# %% ../nbs/docstrings.ipynb 1
CHANNELS_FIRST_DOC = "Whether the inputs are in channels first format `(B, C, ...)` or not `(B, ..., C)`."
CONFIG_INSTANCE_DOC = (
    "An instance of the Config class that contains all the configuration parameters. It can also be passed as "
    "a dictionary and the instance will be created automatically."
)
CONFIG_KWARGS_DOC = "Additional keyword arguments for configuration."
CHECKPOINTING_LEVEL_DOC = (
    "The level of checkpointing to use for activation checkpointing. Refer to "
    ":py:class:`~vision_architectures.utils.activation_checkpointing.ActivationCheckpointing` for more details."
)
INPUT_1D_DOC = "Tensor of shape `(B, T, C)` representing the input features."
INPUT_2D_DOC = "Tensor of shape `(B, C, Y, X)` or `(B, Y, X, C)` representing the input features."
INPUT_3D_DOC = "Tensor of shape `(B, C, Z, Y, X)` or `(B, Z, Y, X, C)` representing the input features."
OUTPUT_1D_DOC = "Tensor of shape `(B, T, C)` representing the output features."
OUTPUT_2D_DOC = "Tensor of shape `(B, C, Y, X)` or `(B, Y, X, C)` representing the output features."
OUTPUT_3D_DOC = "Tensor of shape `(B, C, Z, Y, X)` or `(B, Z, Y, X, C)` representing the output features."
RELATIVE_POSITION_BIAS_DOC = "Relative position embeddings for the attention mechanism."
LOGIT_SCALE_DOC = "Optional scaling factor for the attention logits."
CLASS_DESCRIPTION_1D_DOC = "This class is designed for 1D input eg. language, patchified images, etc."
CLASS_DESCRIPTION_2D_DOC = "This class is designed for 2D input eg. natural images etc."
CLASS_DESCRIPTION_3D_DOC = "This class is designed for 3D input eg. medical images, videos etc."
SPACINGS_DOC = "Spacing information of shape `(B, 3)` of the input features."
RETURN_INTERMEDIATES_DOC = "Return intermediate outputs such as layer/block/stage outputs."

BOUNDING_BOXES_FORMAT_DOC = (
    "The bounding boxes are in the format (z_center, y_center, x_center, z_size, y_size, x_size), where the centers "
    "and the sizes are normalized to the range [0, 1] corresponding to the input dimensions."
)

# %% ../nbs/docstrings.ipynb 2
def populate_docstring(*args, **kwargs):
    kwargs = {k: v for k, v in globals().items() if k.endswith("_DOC")} | kwargs

    def decorator(func):
        if func.__doc__:  # Ensure docstring exists
            func.__doc__ = func.__doc__.format(**kwargs)
        return func

    if len(args) > 1:
        raise ValueError("Please provide custom docstrings as keyword arguments.")

    if len(args) == 1 and callable(args[0]):  # if used as @populate_docstring
        return decorator(args[0])

    return decorator  # if used as @populate_docstring(...)
