From e22b0836e79c2a1c7cf422a657ce6f41d6c950b5 Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Fri, 7 Jul 2023 07:58:54 -0700 Subject: [PATCH] [objc] Update docs and fix static analysis build (#16617) - Update some documentation comments. - Use onnxruntime_training.h as the umbrella header so training API docs are included in generated docs. - Fix static analysis build. --- objectivec/docs/jazzy_config.yaml | 4 +++- objectivec/include/ort_checkpoint.h | 7 ++----- objectivec/include/ort_training_session.h | 7 ++++++- .../mac-objc-static-analysis-ci-pipeline.yml | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/objectivec/docs/jazzy_config.yaml b/objectivec/docs/jazzy_config.yaml index 676f89d79d..700bb9b46e 100644 --- a/objectivec/docs/jazzy_config.yaml +++ b/objectivec/docs/jazzy_config.yaml @@ -4,7 +4,9 @@ author_url: https://www.onnxruntime.ai github_url: https://github.com/microsoft/onnxruntime objc: true -umbrella_header: ../include/onnxruntime.h +# Specify the training header as umbrella_header so that every public header is included. +# The training header is a superset of the inference-only header. +umbrella_header: ../include/onnxruntime_training.h framework_root: .. readme: ./main_page.md diff --git a/objectivec/include/ort_checkpoint.h b/objectivec/include/ort_checkpoint.h index dbb61b7e01..85e58443bf 100644 --- a/objectivec/include/ort_checkpoint.h +++ b/objectivec/include/ort_checkpoint.h @@ -13,12 +13,9 @@ NS_ASSUME_NONNULL_BEGIN * their gradients, optimizer parameters, and user properties. The `ORTTrainingSession` leverages the * `ORTCheckpoint` by accessing and updating the contained training state. * - * Available since v1.16.0. + * Available since 1.16. * - * @note Note that the training session created with a checkpoint state uses this state to store the entire training - * state (including model parameters, its gradients, the optimizer states and the properties). The ORTTraingSession - * does not hold a copy of the checkpoint state. Therefore, it is required that the checkpoint state outlive the - * lifetime of the training session. + * @note This class is only available when the training APIs are enabled. */ @interface ORTCheckpoint : NSObject diff --git a/objectivec/include/ort_training_session.h b/objectivec/include/ort_training_session.h index ec0a46d331..15c0137817 100644 --- a/objectivec/include/ort_training_session.h +++ b/objectivec/include/ort_training_session.h @@ -23,7 +23,9 @@ NS_ASSUME_NONNULL_BEGIN * [onnxruntime-training python utility](https://github.com/microsoft/onnxruntime/blob/main/orttraining/orttraining/python/training/onnxblock/README.md) * can be used to generate above training artifacts. * - * Available since v1.16.0. + * Available since 1.16. + * + * @note This class is only available when the training APIs are enabled. */ @interface ORTTrainingSession : NSObject @@ -45,6 +47,9 @@ NS_ASSUME_NONNULL_BEGIN * @param error Optional error information set if an error occurs. * @return The instance, or nil if an error occurs. * + * @note Note that the training session created with a checkpoint state uses this state to store the entire training + * state (including model parameters, its gradients, the optimizer states and the properties). The training session + * keeps a strong (owning) pointer to the checkpoint state. */ - (nullable instancetype)initWithEnv:(ORTEnv*)env sessionOptions:(ORTSessionOptions*)sessionOptions diff --git a/tools/ci_build/github/azure-pipelines/mac-objc-static-analysis-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-objc-static-analysis-ci-pipeline.yml index 020ae1c58c..6893fb95cf 100644 --- a/tools/ci_build/github/azure-pipelines/mac-objc-static-analysis-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-objc-static-analysis-ci-pipeline.yml @@ -23,6 +23,7 @@ jobs: --cmake_generator "Unix Makefiles" \ --config Debug \ --build_shared_lib --use_coreml --build_objc \ + --enable_training_apis \ --cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON \ --update --skip_submodule_sync \ --build --parallel --target onnx_proto