def Head(num_classes=1000, classifier_activation=None, name=None):
    """Implementation of classification head of ConvNeXt.

    Args:
        num_classes: number of classes for Dense layer
        classifier_activation: activation function for the Dense layer
        name: name prefix

    Returns:
        Classification head function.
    """
    if name is None:
        name = str(backend.get_uid("head"))

    def apply(x):
        x = layers.GlobalAveragePooling2D(name=name + "_head_gap")(x)
        x = layers.LayerNormalization(
            epsilon=1e-6, name=name + "_head_layernorm"
        )(x)
        x = layers.Dense(
            num_classes,
            activation=classifier_activation,
            name=name + "_head_dense",
        )(x)
        return x

    return apply
Implementation of classification head of ConvNeXt.

    Args:
        num_classes: number of classes for Dense layer
        classifier_activation: activation function for the Dense layer
        name: name prefix

    Returns:
        Classification head function.
    
keras/src/applications/convnext.py