@@ -263,10 +263,10 @@ class ModuleTest: XCTestCase {
263263 XCTAssertFalse ( desc. contains ( " 0x " ) , " description should not include a pointer: \( desc) " )
264264 }
265265
266- // Regression test for the lazy load_method path: after load(options),
267- // forward() triggers load_method which must still see valid backend
268- // options. Requires a delegated model — the plain add.pte has no
269- // delegates and so does not exercise the code path .
266+ // Exercises the full feature end-to-end against a delegated model:
267+ // load(options) installs backend options, then forward() triggers lazy
268+ // load_method which consumes them. A delegated fixture is required so
269+ // the per-delegate option lookup actually runs .
270270 func testLoadWithBackendOptionsThenExecuteOnCoreMLDelegatedModel( ) throws {
271271 let modelPath = try requireFixture ( " add_coreml " , ofType: " pte " )
272272 let module = Module ( filePath: modelPath)
@@ -278,17 +278,17 @@ class ModuleTest: XCTestCase {
278278 ] )
279279 XCTAssertNoThrow ( try module. load ( options) )
280280 // No explicit load("forward") here — exercise the lazy load_method path
281- // that previously dereferenced a dangling LoadBackendOptionsMap.
281+ // that consumes the retained LoadBackendOptionsMap.
282282 let inputs : [ Tensor < Float > ] = [ Tensor ( [ 1 ] ) , Tensor ( [ 1 ] ) ]
283283 var outputs : [ Value ] ?
284284 XCTAssertNoThrow ( outputs = try module. forward ( inputs) )
285285 XCTAssertEqual ( outputs? . first? . tensor ( ) , Tensor ( [ Float ( 2 ) ] ) )
286286 }
287287
288- // Regression test: calling load(_:BackendOptionsMap) twice on the same
289- // Module must remain safe . The Module retains the most recently passed
290- // map via ARC; the previous one is released only after the new one is
291- // installed, so the C++ pointer it stored is always valid.
288+ // Calling load(_:BackendOptionsMap) repeatedly replaces the installed
289+ // options . The Module retains the most recently passed map via ARC; the
290+ // previous one is released only after the new one is installed, so the
291+ // C++ pointer it stored is always valid.
292292 func testRepeatedLoadWithBackendOptionsThenExecuteOnCoreMLDelegatedModel( ) throws {
293293 let modelPath = try requireFixture ( " add_coreml " , ofType: " pte " )
294294 let module = Module ( filePath: modelPath)
0 commit comments