NetDelete
Details
- NetDelete is typically used to remove a layer or a port in a net.
- Layers can only be deleted from a chain or graph if their inputs and outputs are the same size, or if they are at the periphery of the network.
Examples
open all close allBasic Examples (2)
chain = NetChain[{3, Ramp, 4}]NetDelete[chain, 2]Delete an output port from a graph:
graph = NetGraph[{3, Ramp, 4}, {1 -> 2 -> 3 -> NetPort["Output1"], 2 -> NetPort["Output2"]}]NetDelete[graph, NetPort["Output2"]]Scope (5)
Delete a layer from a chain, specifying the layer by name:
chain = NetChain[<|"a" -> 3, "b" -> Ramp, "c" -> 4|>]NetDelete[chain, "b"]graph = NetGraph[{3, Ramp, 4}, {1 -> 2 -> 3}]NetDelete[graph, 3]Delete multiple layers from a chain:
chain = NetChain[{2, Ramp, 3, Ramp, 4}]NetDelete[chain, {2, 4}]Delete multiple output ports from a graph:
graph = NetGraph[{2, Ramp, 3, Ramp, 4}, {1 -> 2 -> 3 -> 4 -> 5 -> NetPort["Output1"], 2 -> NetPort["Output2"], 4 -> NetPort["Output3"]}]NetDelete[graph, {NetPort["Output2"], NetPort["Output3"]}]Delete an input state port from a graph:
graph = NetGraph[
{LongShortTermMemoryLayer[2, "Input" -> {"Varying", 2}]},
{NetPort["InitialState"] -> NetPort[1, "State"], NetPort["InitialCellState"] -> NetPort[1, "CellState"]}]NetDelete[graph, NetPort["InitialState"]]Tech Notes
Related Guides
History
Text
Wolfram Research (2018), NetDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/NetDelete.html.
CMS
Wolfram Language. 2018. "NetDelete." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NetDelete.html.
APA
Wolfram Language. (2018). NetDelete. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetDelete.html
BibTeX
@misc{reference.wolfram_2026_netdelete, author="Wolfram Research", title="{NetDelete}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/NetDelete.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_netdelete, organization={Wolfram Research}, title={NetDelete}, year={2018}, url={https://reference.wolfram.com/language/ref/NetDelete.html}, note=[Accessed: 12-June-2026]}