mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
### Description - Implement Objective-C binding for `ORTTrainingSession` - Add `ORTUtils` utility class to handle conversion between C++ and Objective-C types - Add test case for saving checkpoint - Add unit test cases for `ORTTrainingSession` ### Motivation and Context This PR is part of implementing Objective-C bindings for training API. It implements objective-c binding for training session. The objective-C API closely resembles the C++ API. --------- Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
32 lines
900 B
Objective-C
32 lines
900 B
Objective-C
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <variant>
|
|
|
|
#import "cxx_api.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
@class ORTValue;
|
|
|
|
namespace utils {
|
|
|
|
NSString* toNSString(const std::string& str);
|
|
NSString* _Nullable toNullableNSString(const std::optional<std::string>& str);
|
|
|
|
std::string toStdString(NSString* str);
|
|
std::optional<std::string> toStdOptionalString(NSString* _Nullable str);
|
|
|
|
std::vector<std::string> toStdStringVector(NSArray<NSString*>* strs);
|
|
NSArray<NSString*>* toNSStringNSArray(const std::vector<std::string>& strs);
|
|
|
|
NSArray<ORTValue*>* _Nullable wrapUnownedCAPIOrtValues(const std::vector<OrtValue*>& values, NSError** error);
|
|
|
|
std::vector<const OrtValue*> getWrappedCAPIOrtValues(NSArray<ORTValue*>* values);
|
|
|
|
} // namespace utils
|
|
|
|
NS_ASSUME_NONNULL_END
|