Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • 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

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

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
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • 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
ElementwiseLayer
  • See Also
    • ParametricRampLayer
    • ThreadingLayer
    • FunctionLayer
    • NetArrayLayer
    • RandomArrayLayer
    • NetChain
    • NetGraph
    • SoftmaxLayer
    • DropoutLayer
    • Tanh
    • Ramp
    • LogisticSigmoid
  • Related Guides
    • Neural Network Layers
  • Tech Notes
    • Neural Networks in the Wolfram Language
    • See Also
      • ParametricRampLayer
      • ThreadingLayer
      • FunctionLayer
      • NetArrayLayer
      • RandomArrayLayer
      • NetChain
      • NetGraph
      • SoftmaxLayer
      • DropoutLayer
      • Tanh
      • Ramp
      • LogisticSigmoid
    • Related Guides
      • Neural Network Layers
    • Tech Notes
      • Neural Networks in the Wolfram Language

ElementwiseLayer[f]

represents a net layer that applies a unary function f to every element of the input array.

ElementwiseLayer["name"]

applies the function specified by "name".

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Applications  
Properties & Relations  
Possible Issues  
See Also
Tech Notes
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • ParametricRampLayer
    • ThreadingLayer
    • FunctionLayer
    • NetArrayLayer
    • RandomArrayLayer
    • NetChain
    • NetGraph
    • SoftmaxLayer
    • DropoutLayer
    • Tanh
    • Ramp
    • LogisticSigmoid
  • Related Guides
    • Neural Network Layers
  • Tech Notes
    • Neural Networks in the Wolfram Language
    • See Also
      • ParametricRampLayer
      • ThreadingLayer
      • FunctionLayer
      • NetArrayLayer
      • RandomArrayLayer
      • NetChain
      • NetGraph
      • SoftmaxLayer
      • DropoutLayer
      • Tanh
      • Ramp
      • LogisticSigmoid
    • Related Guides
      • Neural Network Layers
    • Tech Notes
      • Neural Networks in the Wolfram Language

ElementwiseLayer

ElementwiseLayer[f]

represents a net layer that applies a unary function f to every element of the input array.

ElementwiseLayer["name"]

applies the function specified by "name".

Details and Options

  • The function f can be any one of the following: Ramp, LogisticSigmoid, Tan, Tanh, ArcTan, ArcTanh, Sin, Sinh, ArcSin, ArcSinh, Cos, Cosh, ArcCos, ArcCosh, Cot, Coth, ArcCot, ArcCoth, Csc, Csch, ArcCsc, ArcCsch, Sec, Sech, ArcSec, ArcSech, Haversine, InverseHaversine, Gudermannian, InverseGudermannian, Log, Exp, Sqrt, CubeRoot, Abs, Gamma, LogGamma, Erf, InverseErf, Erfc, InverseErfc, Round, Floor, Ceiling, Sign, FractionalPart, IntegerPart, Unitize, KroneckerDelta.
  • In general, f can be any object that when applied to a single argument gives any combination of Ramp, LogisticSigmoid, etc., together with numbers, Plus, Subtract, Times, Divide, Power, Surd, Min, Max, Clip, Mod, Threshold, Chop and some logical operations using If, And, Or, Which, Piecewise, Equal, Greater, GreaterEqual, Less, LessEqual, Unequal, Negative, NonNegative, Positive, NonPositive, PossibleZeroQ.
  • ElementwiseLayer supports the following values for "name":
  • "RectifiedLinearUnit" or "ReLU"Ramp[x]
    "ExponentialLinearUnit" or "ELU"x when x≥0 Exp[x]-1 when x<0
    "ScaledExponentialLinearUnit" or "SELU"1.0507 x when x >= 0 1.758099340847161` (Exp[x]-1) when x<0
    "GaussianErrorLinearUnit" or "GELU"0.5 x(1+Erf[x/Sqrt[2]])
    "Swish"x LogisticSigmoid[x]
    "HardSwish"x Min[Max[x+3,0],6]/6
    "Mish"x Tanh[Log[1+Exp[x]]]
    "SoftSign"x/(1+Abs[x])
    "SoftPlus"Log[Exp[x]+1]
    "HardTanh"Clip[x,{-1,1}]
    "HardSigmoid"Clip[(x+1)/2, {0,1}]
    "Sigmoid"LogisticSigmoid[x]
  • ElementwiseLayer[…][input] explicitly computes the output from applying the layer.
  • ElementwiseLayer[…][{input1,input2,…}] explicitly computes outputs for each of the inputi.
  • When given a NumericArray as input, the output will be a NumericArray.
  • ElementwiseLayer is typically used inside NetChain, NetGraph, etc.
  • ElementwiseLayer exposes the following ports for use in NetGraph etc.:
  • "Input"an array of arbitrary rank
    "Output"an array with the same dimensions as the input
  • When it cannot be inferred from other layers in a larger net, the option "Input"->{n1,n2,…} can be used to fix the input dimensions of ElementwiseLayer.
  • Options[ElementwiseLayer] gives the list of default options to construct the layer. Options[ElementwiseLayer[…]] gives the list of default options to evaluate the layer on some data.
  • Information[ElementwiseLayer[…]] gives a report about the layer.
  • Information[ElementwiseLayer[…],prop] gives the value of the property prop of ElementwiseLayer[…]. Possible properties are the same as for NetGraph.

Examples

open all close all

Basic Examples  (2)

Create an ElementwiseLayer that computes Tanh of each input element:

Create an ElementwiseLayer that multiplies its input by a fixed constant:

Apply the layer to an input vector:

Scope  (3)

Create a ElementwiseLayer that computes a "hard sigmoid":

Apply the layer to a batch of inputs:

Plot the behavior of the layer:

Create an ElementwiseLayer that takes vectors of size 3:

Apply the layer to a single vector:

When applied, the layer will automatically thread over a batch of vectors:

Create an ElementwiseLayer that computes a Gaussian:

Apply the layer to a range of values and plot the result:

Applications  (3)

Train a 16-layer-deep, self-normalizing network described in "Self-Normalizing Neural Networks", G. Klambauer et. al., 2017, on the UCI Letter dataset. Obtain the data:

Self-normalizing nets assume that the input data has mean of 0 and variance of 1. Standardize the test and training data:

Verify that the sample mean and variance of the training data are 0 and 1, respectively:

Define a 16-layer, self-normalizing net with "AlphaDropout":

Train the net:

Obtain the accuracy:

Compare the accuracy against the "RandomForest" method in Classify:

Allow a classification network to deal with a "non-separable" problem. Create a synthetic training set consisting of points on a disk, separated into two classes by the circle r=0.5:

Create a layer composed of two LinearLayer layers, and a final transformation into a probability using an ElementwiseLayer:

Train the network on the data:

The net was not able to separate the two classes:

Because LinearLayer is an affine layer, stacking the two layers without an intervening nonlinearity is equivalent to using a single layer. A single line in the plane cannot separate the two classes, which is the level set of a single LinearLayer.

Train a similar net that has a Tanh nonlinearity between the two layers:

The net can now separate the classes:

Binary classification tasks require that the output of a net be a probability. ElementwiseLayer[LogisticSigmoid] can be used to take an arbitrary scalar and produce a value between 0 and 1. Create a net that takes a vector of length 2 and produces a binary prediction:

Train the net to decide if the first number in the vector is greater than the second:

Evaluate the net on several inputs:

The underlying output is a probability, which can be seen by disabling the "Boolean" decoder:

Properties & Relations  (1)

ElementwiseLayer is automatically used when an appropriate function is specified in a NetChain or NetGraph:

Possible Issues  (3)

ElementwiseLayer cannot accept symbolic inputs:

Certain choices of f can produce failures for inputs outside their domain:

Certain functions are not supported directly:

Approximate the Zeta function using a rational function:

The approximation is good over the range (-10,10):

Construct an ElementwiseLayer using the approximation:

Measure the error of the approximation on specific inputs:

The network will fail when evaluated at a pole:

See Also

ParametricRampLayer  ThreadingLayer  FunctionLayer  NetArrayLayer  RandomArrayLayer  NetChain  NetGraph  SoftmaxLayer  DropoutLayer  Tanh  Ramp  LogisticSigmoid

Tech Notes

    ▪
  • Neural Networks in the Wolfram Language

Related Guides

    ▪
  • Neural Network Layers

History

Introduced in 2016 (11.0) | Updated in 2017 (11.1) ▪ 2017 (11.2) ▪ 2018 (11.3) ▪ 2021 (12.3) ▪ 2021 (13.0) ▪ 2022 (13.1)

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2025_elementwiselayer, organization={Wolfram Research}, title={ElementwiseLayer}, year={2022}, url={https://reference.wolfram.com/language/ref/ElementwiseLayer.html}, note=[Accessed: 01-December-2025]}

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
  • System Modeler

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

  • Wolfram Player
  • Wolfram Engine

  • 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
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English