xref: /aosp_15_r20/external/executorch/backends/apple/coreml/runtime/sdk/ETCoreMLModelStructurePath.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 //
2 // ETCoreModelStructurePath.h
3 //
4 // Copyright © 2024 Apple Inc. All rights reserved.
5 //
6 // Please refer to the license found in the LICENSE file in the root directory of the source tree.
7 
8 #import <Foundation/Foundation.h>
9 
10 #import "program_path.h"
11 
12 NS_ASSUME_NONNULL_BEGIN
13 /// A class representing the path to a node in the model structure.
14 ///
15 /// For a ML Program (ExecuTorch program), the structure is comprised of `Program`, `Function`, `Block`, and `Operation`
16 /// nodes. The path can refer to any node in the structure.
17 ///
18 /// The class is a thin wrapper over `executorchcoreml::modelstructure::path`.
19 ///
20 __attribute__((objc_subclassing_restricted))
21 @interface ETCoreMLModelStructurePath : NSObject<NSCopying>
22 
23 - (instancetype)init NS_UNAVAILABLE;
24 
25 + (instancetype)new NS_UNAVAILABLE;
26 
27 /// Constructs an `ETCoreMLModelStructurePath` instance.
28 ///
29 /// @param value The cpp value.
30 - (instancetype)initWithUnderlyingValue:(executorchcoreml::modelstructure::Path)value NS_DESIGNATED_INITIALIZER;
31 
32 /// Constructs an `ETCoreMLModelStructurePath` instance.
33 ///
34 /// @param components The path components.`
35 - (instancetype)initWithComponents:(NSArray<NSDictionary<NSString*, id>*>*)components;
36 
37 /// The underlying value.
38 @property (readonly, assign, nonatomic) executorchcoreml::modelstructure::Path underlyingValue;
39 
40 /// If the path refers to an operation then it returns the operation's output name otherwise `nil`.
41 @property (readonly, copy, nonatomic, nullable) NSString* operationOutputName;
42 
43 @end
44 
45 NS_ASSUME_NONNULL_END
46