onnxruntime/objectivec/src/ort_xnnpack_execution_provider.mm
JiCheng f4cd35f9b1
[xnnpack-ep] NEW EP API in objc (#13941)
### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
2022-12-15 20:12:02 +08:00

31 lines
876 B
Text

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#import "ort_xnnpack_execution_provider.h"
#import "src/cxx_api.h"
#import "src/error_utils.h"
#import "src/ort_session_internal.h"
NS_ASSUME_NONNULL_BEGIN
@implementation ORTXnnpackExecutionProviderOptions
@end
@implementation ORTSessionOptions (ORTSessionOptionsXnnpackEP)
- (BOOL)appendXnnpackExecutionProviderWithOptions:(ORTXnnpackExecutionProviderOptions*)options
error:(NSError**)error {
try {
NSDictionary* provider_options = @{
@"intra_op_num_threads" : [NSString stringWithFormat:@"%d", options.intra_op_num_threads]
};
return [self appendExecutionProvider:@"XNNPACK" providerOptions:provider_options error:error];
}
ORT_OBJC_API_IMPL_CATCH_RETURNING_BOOL(error);
}
@end
NS_ASSUME_NONNULL_END