Skip to content

Commit aebd0ba

Browse files
Revert "Introduce unload method API to Module. (#13364)"
This reverts commit 1d5a214.
1 parent 78591f9 commit aebd0ba

File tree

3 files changed

+0
-37
lines changed

3 files changed

+0
-37
lines changed

extension/apple/ExecuTorch/Exported/ExecuTorchModule.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,6 @@ __attribute__((deprecated("This API is experimental.")))
187187
*/
188188
- (BOOL)isMethodLoaded:(NSString *)methodName NS_SWIFT_NAME(isLoaded(_:));
189189

190-
/**
191-
* Unloads a method and releases its native resources and planned buffers.
192-
*
193-
* @param methodName The method to unload.
194-
* @return YES if the method was unloaded; NO if it was not loaded at all.
195-
*/
196-
- (BOOL)unloadMethod:(NSString *)methodName NS_SWIFT_NAME(unload(_:));
197-
198190
/**
199191
* Retrieves the set of method names available in the loaded program.
200192
*

extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,6 @@ - (BOOL)isMethodLoaded:(NSString *)methodName {
300300
return _module->is_method_loaded(methodName.UTF8String);
301301
}
302302

303-
- (BOOL)unloadMethod:(NSString *)methodName {
304-
const auto didUnload = _module->unload_method(methodName.UTF8String);
305-
[_inputs removeObjectForKey:methodName];
306-
[_outputs removeObjectForKey:methodName];
307-
return didUnload;
308-
}
309-
310303
- (nullable NSSet<NSString *> *)methodNames:(NSError **)error {
311304
const auto result = _module->method_names();
312305
if (!result.ok()) {

extension/apple/ExecuTorch/__tests__/ModuleTest.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,4 @@ class ModuleTest: XCTestCase {
149149
XCTAssertEqual(methodMetadata.backendNames.count, 0)
150150
XCTAssertEqual(methodMetadata.instructionCount, 1)
151151
}
152-
153-
func testUnloadMethod() {
154-
guard let modelPath = resourceBundle.path(forResource: "add", ofType: "pte") else {
155-
XCTFail("Couldn't find the model file")
156-
return
157-
}
158-
let module = Module(filePath: modelPath)
159-
XCTAssertNoThrow(try module.load("forward"))
160-
XCTAssertTrue(module.isLoaded("forward"))
161-
162-
XCTAssertNoThrow(try module.setInputs(Tensor<Float>([1]), Tensor<Float>([2])))
163-
XCTAssertEqual(try module.forward(), Tensor<Float>([3]))
164-
165-
XCTAssertTrue(module.unload("forward"))
166-
XCTAssertFalse(module.isLoaded("forward"))
167-
XCTAssertFalse(module.unload("forward"))
168-
169-
XCTAssertThrowsError(try module.forward())
170-
XCTAssertTrue(module.isLoaded("forward"))
171-
XCTAssertNoThrow(try module.setInputs(Tensor<Float>([2]), Tensor<Float>([3])))
172-
XCTAssertEqual(try module.forward(), Tensor<Float>([5]))
173-
}
174152
}

0 commit comments

Comments
 (0)