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×
  • Options[PrependLayer] gives the list of default options to construct the layer. Options[PrependLayer[]] gives the list of default options to evaluate the layer on some data.
  • Information[PrependLayer[]] gives a report about the layer.
  • Information[PrependLayer[],prop] gives the value of the property prop of PrependLayer[]. Possible properties are the same as for NetGraph.

Examples

open allclose all

Basic Examples  (2)

Create a PrependLayer:

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

Apply this layer to inputs:

Scope  (1)

Create a PrependLayer that takes a sequence of vectors as input and appends another vector to it:

Apply this layer to inputs:

Introduced in 2019
 (12.0)