Update to 1.18.0 resources (#17)

* update to 1.18.0 resources

* Update Package.swift

Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>

* update

---------

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
This commit is contained in:
Rachel Guo
2024-06-04 15:41:38 -07:00
committed by GitHub
parent ce64739c6d
commit 11c7dd6dd4
9 changed files with 53 additions and 14 deletions
+12 -2
View File
@@ -19,8 +19,9 @@
NS_ASSUME_NONNULL_BEGIN
@implementation ORTTrainingSession {
std::optional<Ort::TrainingSession> _session;
ORTEnv* _env; // keep a strong reference so the ORTEnv doesn't get destroyed before this does
ORTCheckpoint* _checkpoint;
std::optional<Ort::TrainingSession> _session;
}
- (Ort::TrainingSession&)CXXAPIOrtTrainingSession {
@@ -28,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (nullable instancetype)initWithEnv:(ORTEnv*)env
sessionOptions:(ORTSessionOptions*)sessionOptions
sessionOptions:(nullable ORTSessionOptions*)sessionOptions
checkpoint:(ORTCheckpoint*)checkpoint
trainModelPath:(NSString*)trainModelPath
evalModelPath:(nullable NSString*)evalModelPath
@@ -39,9 +40,17 @@ NS_ASSUME_NONNULL_BEGIN
}
try {
if (!sessionOptions) {
sessionOptions = [[ORTSessionOptions alloc] initWithError:error];
if (!sessionOptions) {
return nil;
}
}
std::optional<std::string> evalPath = utils::toStdOptionalString(evalModelPath);
std::optional<std::string> optimizerPath = utils::toStdOptionalString(optimizerModelPath);
_env = env;
_checkpoint = checkpoint;
_session = Ort::TrainingSession{
[env CXXAPIOrtEnv],
@@ -50,6 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
trainModelPath.UTF8String,
evalPath,
optimizerPath};
return self;
}
ORT_OBJC_API_IMPL_CATCH_RETURNING_NULLABLE(error)