diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorch.h b/extension/apple/ExecuTorch/Exported/ExecuTorch.h index e16439714f2..3a12a5ddbae 100644 --- a/extension/apple/ExecuTorch/Exported/ExecuTorch.h +++ b/extension/apple/ExecuTorch/Exported/ExecuTorch.h @@ -6,4 +6,8 @@ * LICENSE file in the root directory of this source tree. */ +#import "ExecuTorchError.h" #import "ExecuTorchLog.h" +#import "ExecuTorchModule.h" +#import "ExecuTorchTensor.h" +#import "ExecuTorchValue.h" diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchError.h b/extension/apple/ExecuTorch/Exported/ExecuTorchError.h new file mode 100644 index 00000000000..cdf52051d05 --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchError.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +FOUNDATION_EXPORT NSErrorDomain const ExecuTorchErrorDomain NS_SWIFT_NAME(ErrorDomain); + +NS_ASSUME_NONNULL_END diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchError.m b/extension/apple/ExecuTorch/Exported/ExecuTorchError.m new file mode 100644 index 00000000000..43996dc213e --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchError.m @@ -0,0 +1,11 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "ExecuTorchError.h" + +NSErrorDomain const ExecuTorchErrorDomain = @"org.pytorch.executorch.error"; diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchModule.h b/extension/apple/ExecuTorch/Exported/ExecuTorchModule.h new file mode 100644 index 00000000000..5e6e0ecaf47 --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchModule.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "ExecuTorchValue.h" + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(Module) +__attribute__((deprecated("This API is experimental."))) +@interface ExecuTorchModule : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm b/extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm new file mode 100644 index 00000000000..866dcc6901b --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm @@ -0,0 +1,20 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "ExecuTorchModule.h" + +#import "ExecuTorchError.h" + +#import +#import + +@implementation ExecuTorchModule { + std::unique_ptr _module; +} + +@end diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h b/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h new file mode 100644 index 00000000000..220e377b60d --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(Tensor) +__attribute__((deprecated("This API is experimental."))) +@interface ExecuTorchTensor : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.mm b/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.mm new file mode 100644 index 00000000000..4b072444bec --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.mm @@ -0,0 +1,19 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "ExecuTorchTensor.h" + +#import "ExecuTorchError.h" + +#import + +@implementation ExecuTorchTensor { + ::executorch::extension::TensorPtr _tensor; +} + +@end diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchValue.h b/extension/apple/ExecuTorch/Exported/ExecuTorchValue.h new file mode 100644 index 00000000000..9b2c8aaaae6 --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchValue.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "ExecuTorchTensor.h" + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(Value) +__attribute__((deprecated("This API is experimental."))) +@interface ExecuTorchValue : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchValue.m b/extension/apple/ExecuTorch/Exported/ExecuTorchValue.m new file mode 100644 index 00000000000..98a6f774176 --- /dev/null +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchValue.m @@ -0,0 +1,13 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "ExecuTorchValue.h" + +@implementation ExecuTorchValue + +@end diff --git a/extension/apple/ExecuTorch/__tests__/ModuleTest.swift b/extension/apple/ExecuTorch/__tests__/ModuleTest.swift new file mode 100644 index 00000000000..609727ec93f --- /dev/null +++ b/extension/apple/ExecuTorch/__tests__/ModuleTest.swift @@ -0,0 +1,21 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +@testable import ExecuTorch + +import XCTest + +class ModuleTest: XCTestCase { + func test() throws { + let bundle = Bundle(for: type(of: self)) + guard let modelPath = bundle.path(forResource: "add", ofType: "pte") else { + XCTFail("Couldn't find the model file") + return + } + } +} diff --git a/extension/apple/ExecuTorch/__tests__/TensorTest.swift b/extension/apple/ExecuTorch/__tests__/TensorTest.swift new file mode 100644 index 00000000000..f5c2ccdbeba --- /dev/null +++ b/extension/apple/ExecuTorch/__tests__/TensorTest.swift @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +@testable import ExecuTorch + +import XCTest + +class TensorTest: XCTestCase { + func test() { + } +} diff --git a/extension/apple/ExecuTorch/__tests__/ValueTest.swift b/extension/apple/ExecuTorch/__tests__/ValueTest.swift new file mode 100644 index 00000000000..56802ee540c --- /dev/null +++ b/extension/apple/ExecuTorch/__tests__/ValueTest.swift @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +@testable import ExecuTorch + +import XCTest + +class ValueTest: XCTestCase { + func test() { + } +}