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×


open all close all

Basic Examples  (2)

Create a PrependLayer:

Click for copyable input

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

Click for copyable input

Apply this layer to inputs:

Click for copyable input

Scope  (1)

Introduced in 2019