gives a net in which all layers matching patt are replaced with layer.
performs all replacements specified by the rulei.
Details and Options
- The patterns can be either expressions that match a specific net head, such as _ElementwiseLayer, or literal layers, such as ElementwiseLayer[Ramp].
- When a literal layer is matched, all user-provided parameters must match exactly. Input and output dimensions need not match.
- Layers will be matched at any depth in the original net.
- If the replacement value is Nothing, the corresponding layer of the net will be dropped.
- If no replacements are performed, a message will be issued and the original net will be returned.
Examplesopen allclose all
Basic Examples (3)
Properties & Relations (1)
Replacing a layer with a NetChain will collapse the chain into any parent chain: