@@ -1318,6 +1318,45 @@ public void testCheckpointBackwards() {
13181318 }
13191319 }
13201320
1321+ // GH-16717: Checkpoint resumption fails when distribution=AUTO gets resolved during training.
1322+ // Training mutates the caller's parms object (AUTO -> multinomial), so cloning after training
1323+ // picks up the resolved value. Checkpoint validation then sees AUTO (from _input_parms) vs
1324+ // multinomial (from the cloned parms) and incorrectly throws.
1325+ @ Test
1326+ public void testCheckpointAutoDistribution () {
1327+ Frame tfr = null ;
1328+ DeepLearningModel dl = null ;
1329+ DeepLearningModel dl2 = null ;
1330+
1331+ try {
1332+ tfr = parseTestFile ("./smalldata/iris/iris.csv" );
1333+ DeepLearningParameters parms = new DeepLearningParameters ();
1334+ parms ._train = tfr ._key ;
1335+ parms ._epochs = 1 ;
1336+ parms ._response_column = "C5" ;
1337+ parms ._reproducible = true ;
1338+ parms ._hidden = new int []{2 , 2 };
1339+ parms ._seed = 0xdecaf ;
1340+
1341+ // distribution defaults to AUTO; training resolves it to multinomial and mutates parms
1342+ dl = new DeepLearning (parms ).trainModel ().get ();
1343+
1344+ // Clone AFTER training — parms._distribution is now multinomial (mutated by training)
1345+ DeepLearningParameters parms2 = (DeepLearningParameters ) parms .clone ();
1346+ parms2 ._epochs = 2 ;
1347+ parms2 ._checkpoint = dl ._key ;
1348+
1349+ // This should succeed but fails with:
1350+ // "Cannot change parameter: '_distribution': AUTO -> multinomial"
1351+ dl2 = new DeepLearning (parms2 ).trainModel ().get ();
1352+ Assert .assertTrue (dl2 .epoch_counter > dl .epoch_counter );
1353+ } finally {
1354+ if (tfr != null ) tfr .delete ();
1355+ if (dl != null ) dl .delete ();
1356+ if (dl2 != null ) dl2 .delete ();
1357+ }
1358+ }
1359+
13211360 @ Test
13221361 public void testConvergenceLogloss () {
13231362 Frame tfr = null ;
0 commit comments