def METHOD_NAME(layer: NNCFWrapper):
    layer_metatype = get_keras_layer_metatype(layer)
    if len(layer_metatype.weight_definitions) != 1:
        raise ValueError(f"Could not calculate the number of filters for the layer {layer.layer.name}.")
    weight_def = layer_metatype.weight_definitions[0]
    weight_attr = weight_def.weight_attr_name
    if layer_metatype is TFBatchNormalizationLayerMetatype and not layer.layer.scale:
        nncf_logger.debug(
            "Fused gamma parameter encountered in BatchNormalization layer. "
            "Using beta parameter instead to calculate the number of filters."
        )
        weight_attr = "beta"
    filter_axis = get_filter_axis(layer, weight_attr)
    filters_num = layer.layer_weights[weight_attr].shape[filter_axis]
    return filters_num