extractWeights

Extracts weight arrays from Dense/Linear layers with exact weight preservation. Follows existing ModuleParameter structure patterns from Linear layer implementation.

The Linear layer stores weights as outFeatures, inFeatures and bias as outFeatures following the ModuleParameter.WeightParameter and ModuleParameter.BiasParameter structure.

This method ensures exact weight and bias preservation from trained models by:

  • Extracting weights directly from ModuleParameter structures

  • Preserving exact floating-point precision

  • Maintaining weight matrix layout consistency with DefaultCpuOps

  • Validating weight shapes against tensor specifications

Return

List of WeightArray objects containing weights and biases