Please see FunctionLayer error compilerr: Cannot interpret as a network for a way to achieve this using NetEncoder.
Regards, GW