def get_num_filters(layer):
<EOL>if K.ndim(layer.output) == <NUM_LIT:2>:<EOL><INDENT>return K.int_shape(layer.output)[-<NUM_LIT:1>]<EOL><DEDENT>channel_idx = <NUM_LIT:1> if K.image_data_format() == '<STR_LIT>' else -<NUM_LIT:1><EOL>return K.int_shape(layer.output)[channel_idx]<EOL>
Determines the number of filters within the given `layer`.

    Args:
        layer: The keras layer to use.

    Returns:
        Total number of filters within `layer`.
        For `keras.layers.Dense` layer, this is the total number of outputs.