mighty.utils.common.find_named_layers

mighty.utils.common.find_named_layers(model: Module, layer_class, name_prefix='')[source]

Find all layers of type layer_class in the input model and yield them as (name, layer) tuples.

Parameters:
modelnn.Module

A model.

layer_classtype or tuple of type

A layer class to look for.

name_prefixstr, optional

A name prefix to add to the final result.

Yields:
str

The name of a children layer.

nn.Module

A children layer of instance layer_class found in the input model.