NetRename

NetRename[net,"old""new"]

gives a net in which the name old for a layer is replaced with new.

NetRename[net,NetPort["old"]NetPort["new"]]

gives a net in which the name old for an input or output port is replaced with new.

NetRename[net,{rule1,rule2,}]

performs all renamings specified by the rulei.

NetRename[net,f]

uses a function f to map existing layer names to new names.

NetRename[net,rules,levelspec]

renames layers and ports nested at level levelspec.

Details

  • NetRename is typically used to rename layers and ports in NetChain and NetGraph objects.
  • In NetRename[net,rules,levelspec], levelspec can be:
  • nlevels 1 through n
    {n}level n only
    {n1,n2}levels n1 through n2
  • By default, NetRename will only perform renaming at the outermost level of a NetChain or NetGraph. It will not affect nested chains and graphs.

Examples

open allclose all

Basic Examples  (4)

Rename a single layer in a NetChain:

Rename a single layer in a NetGraph:

Rename multiple layers simultaneously:

Rename layers using a renaming function:

Possible Issues  (1)

Renaming should produce unique names:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_netrename, organization={Wolfram Research}, title={NetRename}, year={2021}, url={https://reference.wolfram.com/language/ref/NetRename.html}, note=[Accessed: 22-November-2024 ]}