LayerCodec
classin packageklyn.math.nn.serialization
public class LayerCodec<T extends AbstractFloat>
LayerCodec

Versioned allowlist for sequential checkpoint operators. Unknown classes and subclasses are rejected rather than flattened to a different computation. No type name supplied by a file is resolved or instantiated reflectively.

Example

descriptor = LayerCodec<Float>.encode(Dense<Float>(10))

Methods
Modifier and Type Member Description
public static boolean
boolean(value as Object) as Boolean
Reads a JSON Boolean without accepting numeric or textual conversions.
public static decode
decode(config as Map<String, Object>) as Layer<T>
Reconstructs a known operator without code execution or reflection.
public static encode
encode(layer as Layer<T>) as Map<String, Object>
Encodes exact built-in layer configuration, not its parameters.
public static integer
integer(value as Object) as Long
Parses a canonical non-negative decimal string without floating conversion.
public static keys
keys(value as Map<String, Object>, expected as IList<String>) as Void
Checks exact keys, rejecting silently ignored configuration.
public static number
number(value as Object) as Double
Reads a JSON number, never a Boolean, null or a numeric string.
public static outputShape
outputShape(layer as Layer<T>, input as IList<Long>) as IList<Long>
Computes output dimensions without allocating trainable parameters.
public static parameterShapes
parameterShapes(layer as Layer<T>, input as IList<Long>) as ArrayList<IList<Long>>
Expected parameter shapes, without parameter allocation.
public static readShape
readShape(value as Object) as ArrayList<Long>
Decodes a bounded, positive, non-overflowing shape.
public static shape
shape(dimensions as IList<Long>) as ArrayList<String>
Encodes dimensions as exact decimal strings.