NetFlatten

NetFlatten[net]

collapses nested NetChain and NetGraph objects within net.

NetFlatten[net,n]

collapses up to nesting level n.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Flatten nested chains:

Flatten nested graphs:

Scope  (3)

Turn a NetChain with nested NetGraph into a unique NetGraph:

Collapse nested NetChain and NetGraph up to level 1:

Turn a flat NetGraph into a NetChain:

Properties & Relations  (3)

NetFlatten flattens nested nets, including within operators.

Construct an operator that contains nested chains:

The inner net of the NetMapOperator has been flattened:

NetFlatten yields a NetChain for a NetGraph that is fully flat:

NetFlatten yields a NetGraph for a NetChain that contains a nested NetGraph:

Wolfram Research (2018), NetFlatten, Wolfram Language function, https://reference.wolfram.com/language/ref/NetFlatten.html (updated 2019).

Text

Wolfram Research (2018), NetFlatten, Wolfram Language function, https://reference.wolfram.com/language/ref/NetFlatten.html (updated 2019).

CMS

Wolfram Language. 2018. "NetFlatten." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/NetFlatten.html.

APA

Wolfram Language. (2018). NetFlatten. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetFlatten.html

BibTeX

@misc{reference.wolfram_2024_netflatten, author="Wolfram Research", title="{NetFlatten}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/NetFlatten.html}", note=[Accessed: 23-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_netflatten, organization={Wolfram Research}, title={NetFlatten}, year={2019}, url={https://reference.wolfram.com/language/ref/NetFlatten.html}, note=[Accessed: 23-November-2024 ]}