1#import <XCTest/XCTest.h> 2 3#include <torch/script.h> 4 5@interface TestAppTests : XCTestCase 6 7@end 8 9@implementation TestAppTests { 10} 11 12- (void)testFullJIT { 13 NSString* modelPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"model" 14 ofType:@"pt"]; 15 auto module = torch::jit::load(modelPath.UTF8String); 16 c10::InferenceMode mode; 17 auto input = torch::ones({1, 3, 224, 224}, at::kFloat); 18 auto outputTensor = module.forward({input}).toTensor(); 19 XCTAssertTrue(outputTensor.numel() == 1000); 20} 21 22@end 23