I’m not sure, how Learner etc. are defined, but it seems they are coming from a high-level API.
Based on the error message, if looks like your last_linear contains the wrong number of input features.
Try to read the in_features attribute before replacing the this layer with your custom one or alternatively try to set it to 8192 (based on the error message).