Using autoencoders and deep transfer learning to determine the stellar parameters of 286 CARMENES M dwarfs