Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • Compute Services
  • System Modeler
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

Wolfram Consulting

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Notebook Assistant + LLM Kit
    • Compute Services
    • System Modeler
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
NetChain
  • See Also
    • NetModel
    • NetGraph
    • NetInitialize
    • NetTrain
    • NetExtract
    • LinearLayer
    • ElementwiseLayer
    • NetEncoder
    • NetDecoder

    • Formats
    • MXNet
  • Related Guides
    • Neural Network Operations
    • Neural Network Layers
    • Neural Networks
    • Neural Network Construction & Properties
    • Computer Vision
    • Image Computation for Microscopy
    • Audio Processing
    • Audio Analysis
  • Tech Notes
    • Neural Networks in the Wolfram Language
    • See Also
      • NetModel
      • NetGraph
      • NetInitialize
      • NetTrain
      • NetExtract
      • LinearLayer
      • ElementwiseLayer
      • NetEncoder
      • NetDecoder

      • Formats
      • MXNet
    • Related Guides
      • Neural Network Operations
      • Neural Network Layers
      • Neural Networks
      • Neural Network Construction & Properties
      • Computer Vision
      • Image Computation for Microscopy
      • Audio Processing
      • Audio Analysis
    • Tech Notes
      • Neural Networks in the Wolfram Language

NetChain[{layer1,layer2,…}]

specifies a neural net in which the output of layeri is connected to the input of layeri+1.

NetChain["name1"layer1,"name2"layer2,…]

specifies a net consisting of a chain of explicitly named layers.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Properties & Relations  
Neat Examples  
See Also
Tech Notes
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • NetModel
    • NetGraph
    • NetInitialize
    • NetTrain
    • NetExtract
    • LinearLayer
    • ElementwiseLayer
    • NetEncoder
    • NetDecoder

    • Formats
    • MXNet
  • Related Guides
    • Neural Network Operations
    • Neural Network Layers
    • Neural Networks
    • Neural Network Construction & Properties
    • Computer Vision
    • Image Computation for Microscopy
    • Audio Processing
    • Audio Analysis
  • Tech Notes
    • Neural Networks in the Wolfram Language
    • See Also
      • NetModel
      • NetGraph
      • NetInitialize
      • NetTrain
      • NetExtract
      • LinearLayer
      • ElementwiseLayer
      • NetEncoder
      • NetDecoder

      • Formats
      • MXNet
    • Related Guides
      • Neural Network Operations
      • Neural Network Layers
      • Neural Networks
      • Neural Network Construction & Properties
      • Computer Vision
      • Image Computation for Microscopy
      • Audio Processing
      • Audio Analysis
    • Tech Notes
      • Neural Networks in the Wolfram Language

NetChain

NetChain[{layer1,layer2,…}]

specifies a neural net in which the output of layeri is connected to the input of layeri+1.

NetChain["name1"layer1,"name2"layer2,…]

specifies a net consisting of a chain of explicitly named layers.

Details and Options

  • The input of a NetChain is taken to be the input of the first layer.
  • The output of a NetChain is taken to be the output of the last layer.
  • All intermediary layers must have exactly one input and one output port.
  • NetChain[…][data] gives the result of applying the net to data.
  • NetChain[…][data,NetPortGradient["Input"]] gives the gradient of the output with respect to the input data.
  • If the first layer has more than one input port, the NetChain will have those same input ports.
  • If the last layer has more than one output port, the NetChain will have those same output ports.
  • NetChain supports the following special layer specifications:
  • Ramp,LogisticSigmoid,…ElementwiseLayer[f]
    nLinearLayer[n]
    {layer1,layer2,…}NetChain[{layer1,layer2,…}]
  • Normal[NetChain[…]] will return a list or association of the layers used to construct the chain.
  • The StandardForm of NetChain shows a summary of the layers in the chain and the array dimensions of the output of each layer. Clicking a layer in the chain shows more information about that layer.
  • The following optional parameter can be included:
  • LearningRateMultipliersAutomaticlearning rate multipliers for the trainable arrays
  • The overall input and output array shapes for the chain can be specified using "Input"->shape and "Output"->shape options for NetChain.
  • Possible forms for shape include:
  • "Real"a single real number
    "Integer"a single integer
    Restricted["Integer",n]an integer between 1 and n
    Restricted["Integer",{m,n}]an integer between m and n
    na vector of length n
    {n1,n2,…}an array of dimensions n1×n2×…
    "Varying"a vector whose length is variable
    {"Varying",n2,n3,…}an array whose first dimension is variable and remaining dimensions are n2×n3×…
    NetEncoder[…]an encoder (for input ports)
    NetEncoder[{…,"Dimensions"{n1,…}}]an encoder mapped over an array of dimensions n1×…
    NetDecoder[…]a decoder (for output ports)
    NetDecoder[{…,"InputDepth"n}}]a decoder applied to an array of rank n
    FeatureExtractorFunction[…]a feature extractor function
  • Any of the lengths ni given as Automatic are inferred from the structure of the chain.
  • NetChain[…][data,…,opts] specifies that options should be used in applying the net to data. Possible options include:
  • BatchSizeAutomaticfor lists of inputs, the number of inputs to evaluate at once
    NetEvaluationMode"Test"what mode to use in performing evaluation
    RandomSeedingAutomatichow to seed pseudorandom generators, if any
    TargetDevice"CPU"the target device on which to perform evaluation
    WorkingPrecision"Real32"the numerical precision used for evaluating the net
  • Possible settings for WorkingPrecision include:
  • "Real32"use single-precision real (32-bit)
    "Real64"use double-precision real (64-bit)
    "Mixed"use half-precision real for certain operations
  • WorkingPrecision->"Mixed" is only supported for TargetDevice->"GPU", where it can result in significant performance increases on certain devices.
  • When given a NumericArray as input, the output will be a NumericArray. In this case, its numeric type is derived from WorkingPrecision.
  • With the setting NetEvaluationMode->"Training", layers such as DropoutLayer will behave as they do for training rather than ordinary evaluation.
  • Normal[NetChain[…]] returns a list or association of the layers used to construct the network. EdgeList[NetChain[…]] returns the list of connections in the network.
  • NetChain[…][[spec]] extracts the layer specified by spec from the net.
  • Transformation on a NetChain[…] network can be achieved with NetReplacePart, NetReplace, NetRename, NetFlatten, NetDelete, NetTake, NetDrop, NetInsert, ….
  • Options[NetChain] gives the list of default options to construct the network. Options[NetChain[…]] gives the list of default options to evaluate the network on some data.
  • Information[NetChain[…]] gives a report about the network.
  • Information[NetChain[…],prop] gives the value of the property prop of NetChain[…]. Possible properties are the same as for NetGraph.

Examples

open all close all

Basic Examples  (1)

Construct a chain consisting of two layers:

Apply the net to an input:

Scope  (4)

Construct a chain consisting of two layers and specifying that the input is a length-2 vector:

Initialize the net with random weights:

Apply the net to an input vector:

Construct a chain with explicitly named layers:

Extract the second layer by name:

Use Part syntax to extract the first layer:

Construct a chain:

Construct a new network consisting of the first two layers:

Construct a new network consisting of the last two layers:

Use special syntax for ElementwiseLayer and LinearLayer:

Properties & Relations  (5)

NetChain objects can be used as layers in a NetGraph:

NetGraph objects with one output and one input port can be used as layers inside NetChain objects:

NetChain objects can be converted to the equivalent NetGraph objects by writing NetGraph[chain]:

The layers used to construct a NetChain can be extracted using Normal:

Use Information[chain,"SummaryGraphic"] to get a Graphics[…] expression that shows the underlying connectivity of a chain:

Neat Examples  (1)

Construct a base network that takes vector inputs of size 2 and produces vector outputs of size 3:

Make a table of 16 randomly initialized copies of the base network:

Plot them in a gallery by treating them as functions mapping (x,y) positions to (r,g,b) color values:

See Also

NetModel  NetGraph  NetInitialize  NetTrain  NetExtract  LinearLayer  ElementwiseLayer  NetEncoder  NetDecoder

Formats: MXNet

Function Repository: NetChainToGraph

Tech Notes

    ▪
  • Neural Networks in the Wolfram Language

Related Guides

    ▪
  • Neural Network Operations
  • ▪
  • Neural Network Layers
  • ▪
  • Neural Networks
  • ▪
  • Neural Network Construction & Properties
  • ▪
  • Computer Vision
  • ▪
  • Image Computation for Microscopy
  • ▪
  • Audio Processing
  • ▪
  • Audio Analysis

History

Introduced in 2016 (11.0) | Updated in 2020 (12.1) ▪ 2022 (13.1)

Wolfram Research (2016), NetChain, Wolfram Language function, https://reference.wolfram.com/language/ref/NetChain.html (updated 2022).

Text

Wolfram Research (2016), NetChain, Wolfram Language function, https://reference.wolfram.com/language/ref/NetChain.html (updated 2022).

CMS

Wolfram Language. 2016. "NetChain." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/NetChain.html.

APA

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

BibTeX

@misc{reference.wolfram_2025_netchain, author="Wolfram Research", title="{NetChain}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/NetChain.html}", note=[Accessed: 01-May-2026]}

BibLaTeX

@online{reference.wolfram_2025_netchain, organization={Wolfram Research}, title={NetChain}, year={2022}, url={https://reference.wolfram.com/language/ref/NetChain.html}, note=[Accessed: 01-May-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English