Skip to content

Commit 4adf496

Browse files
Fix load time. (#5889)
Fix load time. (#5781) Summary: Pull Request resolved: #5781 Once loaded Module does nothing next time, we need to recreate the Module again to truly load the method again. Reviewed By: cccclai Differential Revision: D63678792 fbshipit-source-id: 1e8d6a379215e20620b73c05ce7f734e1d0fc5ce (cherry picked from commit 04669a1) Co-authored-by: Anthony Shoumikhin <[email protected]>
1 parent 0830894 commit 4adf496

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extension/apple/Benchmark/Tests/Tests.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ + (void)initialize {
5454
SEL testLoadSelector = NSSelectorFromString([NSString
5555
stringWithFormat:@"test_load_%@_%@", directoryName, modelName]);
5656
IMP testLoadImplementation = imp_implementationWithBlock(^(id _self) {
57-
auto __block module = std::make_unique<Module>(modelPath.UTF8String);
5857
[_self measureWithMetrics:@[
5958
[XCTClockMetric new],
6059
[XCTMemoryMetric new],
6160
]
6261
options:XCTMeasureOptions.defaultOptions
6362
block:^{
64-
XCTAssertEqual(module->load_method("forward"),
65-
Error::Ok);
63+
XCTAssertEqual(
64+
Module(modelPath.UTF8String).load_forward(),
65+
Error::Ok);
6666
}];
6767
});
6868
class_addMethod(
@@ -81,7 +81,7 @@ + (void)initialize {
8181
const auto num_inputs = method_meta->num_inputs();
8282
XCTAssertGreaterThan(num_inputs, 0);
8383

84-
std::vector<TensorPtr> __block tensors;
84+
std::vector<TensorPtr> tensors;
8585
tensors.reserve(num_inputs);
8686
std::vector<EValue> __block inputs;
8787
inputs.reserve(num_inputs);

0 commit comments

Comments
 (0)