axon icon indicating copy to clipboard operation
axon copied to clipboard

Custom layer serialization implementation

Open seanmor5 opened this issue 2 years ago • 1 comments

Currently custom layers will fail when they are imported if the implementation is not an MFA function (&Module.function/arity). We should consider raising in these cases, or support some other way of serializing custom layers. Another option is to trace the custom layer and serialize the resulting Nx expression and then rebuild the function from the expression

seanmor5 avatar Jul 18 '22 23:07 seanmor5

Serializing the Nx expression would definitely work... but any dynamic part of the expression would be lost (for example, a case that handles Axon.None structs. In other words, we could serialize it if we have the input shapes.

josevalim avatar Jul 19 '22 06:07 josevalim