Skip to content

Commit 04669a1

Browse files
shoumikhinfacebook-github-bot
authored andcommitted
Fix load time. (pytorch#5781)
Summary: Pull Request resolved: pytorch#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
1 parent 8079eb7 commit 04669a1

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
@@ -77,15 +77,15 @@ + (void)initialize {
7777
modelName,
7878
deviceInfo]);
7979
IMP testLoadImplementation = imp_implementationWithBlock(^(id _self) {
80-
auto __block module = std::make_unique<Module>(modelPath.UTF8String);
8180
[_self measureWithMetrics:@[
8281
[XCTClockMetric new],
8382
[XCTMemoryMetric new],
8483
]
8584
options:XCTMeasureOptions.defaultOptions
8685
block:^{
87-
XCTAssertEqual(module->load_method("forward"),
88-
Error::Ok);
86+
XCTAssertEqual(
87+
Module(modelPath.UTF8String).load_forward(),
88+
Error::Ok);
8989
}];
9090
});
9191
class_addMethod(
@@ -107,7 +107,7 @@ + (void)initialize {
107107
const auto num_inputs = method_meta->num_inputs();
108108
XCTAssertGreaterThan(num_inputs, 0);
109109

110-
std::vector<TensorPtr> __block tensors;
110+
std::vector<TensorPtr> tensors;
111111
tensors.reserve(num_inputs);
112112

113113
for (auto index = 0; index < num_inputs; ++index) {

0 commit comments

Comments
 (0)