PrependLayer

PrependLayer[]

represents a net layer that takes an input array and prepends another array to it.

Details and Options

  • PrependLayer exposes the following input ports for use in NetGraph etc.:
  • "Input"array of rank n
    "Element"array of rank n-1
  • PrependLayer exposes the output port "Output", which is an array of rank n.
  • PrependLayer is typically used inside NetGraph.
  • PrependLayer can operate on arrays that contain "Varying" dimensions.
  • PrependLayer[][<|"Input"in,"Element"elem|>] explicitly computes the output from applying the layer, which is effectively given by Prepend[in,elem].
  • When given a NumericArray as input, the output will be a NumericArray.
  • PrependLayer["port"->shape] allows the shape of the input or element port to be specified. Possible forms for shape are:
  • "Real"a single real number
    "Integer"a single integer
    na vector of length n
    {n1,n2,}an array of dimensions n1× n2×
    {"Varying",n2,n3,}a variable-length sequence of arrays of dimensions n2×n3×

Examples

open all close all

Basic Examples  (2)

Create a PrependLayer:

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

Create a PrependLayer that takes a vector as input and appends a scalar:

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

Apply this layer to inputs:

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

Scope  (1)

Introduced in 2019
(12.0)