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)

ReshapeLayer

ReshapeLayer[dims]
represents a net layer that reinterprets the input to be an array of dimensions dims.

Details and OptionsDetails and Options

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

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Create a ReshapeLayer that reshapes any input into a 2x3 matrix:

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

Create a ReshapeLayer that reshapes any input into a 2x2 matrix:

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

Apply the layer to a vector:

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

Apply the layer to a rank-4 tensor:

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