PlaceholderLayer

PlaceholderLayer[]

represents a net layer whose operation is undefined.

PlaceholderLayer["tag",assoc]

indicates a tag and information given by the association assoc.

Details and Options

  • PlaceholderLayer is typically produced when trying to import neural nets from external formats containing unsupported operations.
  • PlaceholderLayer can be used in NetChain or NetGraph to construct net objects that can be manipulated but cannot be trained or evaluated on an input.
  • PlaceholderLayer exposes the following options:
  • "Arrays"Nonea list of array names or an association mapping array names to numeric arrays
    InputPortsAutomaticinput ports
    OutputPortsAutomaticoutput ports
  • Since the layer does not have any evaluation or training behavior, values for "Arrays" do not have any effect besides communicating that the layer is a placeholder for an operation using arrays.
  • Option InputPorts can be used to specify the number, names or shapes of input ports. If InputPorts is not specified, the number of ports and their shapes are inferred from NetChain or NetGraph connectivity.
  • By default, PlaceholderLayer exposes an input port called "Input" and an output port called "Output" with unspecified shapes. Options "Input" and "Output" are available as shortcuts for shape specification in the single-port case.
  • PlaceholderLayer does not perform any shape inference and will allow any combination of input and output ports with any given shape when constructed.
  • Options[PlaceholderLayer] gives the list of default options to construct the layer. Options[PlaceholderLayer[]] gives the list of default options to evaluate the layer on some data.
  • Information[PlaceholderLayer[]] gives a report about the layer.
  • Information[PlaceholderLayer[],prop] gives the value of the property prop of PlaceholderLayer[]. Possible properties are the same as for NetGraph.

Examples

open allclose all

Basic Examples  (2)

Create a PlaceholderLayer:

Create a PlaceholderLayer with given tag and attributes:

Scope  (4)

Create a PlaceholderLayer with two inputs and three outputs having default names and unspecified shapes:

Create a PlaceholderLayer with two inputs and three outputs having explicit names and unspecified shapes:

Create a PlaceholderLayer with two inputs and three outputs having default names and specified shapes:

Create a PlaceholderLayer with two inputs and three outputs having explicit names and specified shapes:

Applications  (1)

PlaceholderLayer is typically produced during import from external formats. Import an ONNX model containing an unsupported operator:

Nets imported with PlaceholderLayer cannot be evaluated on an input:

The missing layer can be added back in various ways. One effective but inefficient solution is to use ordinary Wolfram Language code. Implement the missing operation in Wolfram Language code and create a function to reproduce the results of the full net:

When possible, implementing the missing operation with neural net layers is preferable:

Compare the evaluation time of the two approaches:

Wolfram Research (2020), PlaceholderLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/PlaceholderLayer.html.

Text

Wolfram Research (2020), PlaceholderLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/PlaceholderLayer.html.

CMS

Wolfram Language. 2020. "PlaceholderLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PlaceholderLayer.html.

APA

Wolfram Language. (2020). PlaceholderLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PlaceholderLayer.html

BibTeX

@misc{reference.wolfram_2023_placeholderlayer, author="Wolfram Research", title="{PlaceholderLayer}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/PlaceholderLayer.html}", note=[Accessed: 20-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_placeholderlayer, organization={Wolfram Research}, title={PlaceholderLayer}, year={2020}, url={https://reference.wolfram.com/language/ref/PlaceholderLayer.html}, note=[Accessed: 20-April-2024 ]}