"Function" (Net Encoder)

NetEncoder[{"Function",f,{d1,d2,,dn}]

represents an encoder that uses a custom function f to encode an input producing an output tensor of dimensions d1×d2××dn.

Details

  • NetEncoder[][input] applies the encoder to an input to produce an output.
  • NetEncoder[][{input1,input2,}] applies the encoder to a list of inputs to produce a list of outputs.
  • The input to the encoder inputi is of any type such that f[inputi] produces a tensor of dimensions d1×d2××dn.
  • An encoder can be attached to an input port of a net by specifying "port"->NetEncoder[] when constructing the net.

Examples

open allclose all

Basic Examples  (1)

Create a function encoder that takes a scalar and produces a length-2 list of these scalars:

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

Apply the encoder to a scalar:

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

Apply the encoder to a list of scalars:

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

Scope  (1)

See Also

NetEncoder  NetDecoder  NetChain  NetGraph

Tutorials