Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

FlattenLayer

FlattenLayer[]
represents a net layer that flattens any input into a vector.

Details and OptionsDetails and Options

  • FlattenLayer[][input] explicitly computes the output from applying the layer to input.
  • FlattenLayer[][{input1,input2,}] explicitly computes outputs for each of the inputi.
  • FlattenLayer exposes the following ports for use in NetGraph etc.:
  • "Input"a numerical tensor of arbitrary rank
    "Output"a numerical vector
  • FlattenLayer is typically used inside NetChain, NetGraph, etc.
  • FlattenLayer normally infers the dimensions of its input from its context in NetChain etc. To specify the dimensions explicitly as {n1,n2,}, use FlattenLayer["Input"->{n1,n2,}].

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Create a FlattenLayer:

In[1]:=
Click for copyable input
Out[1]=

Apply the FlattenLayer to a matrix:

In[2]:=
Click for copyable input
Out[2]=

Create a FlattenLayer with a specified input dimension:

In[1]:=
Click for copyable input
Out[1]=

Apply the FlattenLayer to a matrix:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 2016
(11.0)