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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user