"Function" (Net Decoder)

NetDecoder[{"Function",f}]

represents a decoder that applies f to the output of a net to obtain a decoded result.

Details

  • NetDecoder[][input] applies the decoder to an input to produce an output.
  • NetDecoder[][{input1,input2,}] applies the decoder to a list of inputs to produce a list of outputs.
  • A decoder can be attached to an output port of a net by specifying "port"->NetDecoder[] when constructing the net.
  • Options
  • NetDecoder[{"Function",f,"Properties"{"prop1","prop2",}}] can be used to specify that the decoder supports obtaining any of the propi. The function f must then take the property to decode as its second argument. In this case, the default property that will be supplied to f if no specific property is requested is prop1.

Examples

open all close all

Basic Examples  (1)

Create a property that interprets its input as an RGB color:

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

Note that the function is passed a NumericArray and that Normal is used to convert it to a standard array that RGBColor can take.

Decode a 3-vector as an RGB color:

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

Attach the decoder to a randomly generated net:

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

The output of the net is automatically decoded as a color:

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

Possible Issues  (1)