forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS][OSS][BE] Add Simulator tests for full JIT (pytorch#64851)
Summary: Pull Request resolved: pytorch#64851 ghstack-source-id: 137970229 Test Plan: CircleCI Reviewed By: hanton, cccclai Differential Revision: D30877963 fbshipit-source-id: 7bb8ade1959b85c3902ba9dc0660cdac8f558d64
- Loading branch information
1 parent
fd09e56
commit f159f12
Showing
8 changed files
with
120 additions
and
82 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#import <XCTest/XCTest.h> | ||
|
||
#include <torch/script.h> | ||
|
||
@interface TestAppTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation TestAppTests { | ||
} | ||
|
||
- (void)testFullJIT { | ||
NSString* modelPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"model" | ||
ofType:@"pt"]; | ||
auto module = torch::jit::load(modelPath.UTF8String); | ||
c10::InferenceMode mode; | ||
auto input = torch::ones({1, 3, 224, 224}, at::kFloat); | ||
auto outputTensor = module.forward({input}).toTensor(); | ||
XCTAssertTrue(outputTensor.numel() == 1000); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#import <XCTest/XCTest.h> | ||
|
||
#include <torch/csrc/jit/mobile/import.h> | ||
#include <torch/csrc/jit/mobile/module.h> | ||
#include <torch/script.h> | ||
|
||
@interface TestAppTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation TestAppTests { | ||
} | ||
|
||
- (void)testLiteInterpreter { | ||
NSString* modelPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"model_lite" | ||
ofType:@"ptl"]; | ||
auto module = torch::jit::_load_for_mobile(modelPath.UTF8String); | ||
c10::InferenceMode mode; | ||
auto input = torch::ones({1, 3, 224, 224}, at::kFloat); | ||
auto outputTensor = module.forward({input}).toTensor(); | ||
XCTAssertTrue(outputTensor.numel() == 1000); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters