.. _program_listing_file_Project-DJ-Engine_include_util_ai_AI.hpp: Program Listing for File AI.hpp =============================== |exhale_lsh| :ref:`Return to documentation for file ` (``Project-DJ-Engine\include\util\ai\AI.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include "global/PDJE_EXPORT_SETTER.hpp" #include #include #include #include #include #include namespace PDJE_UTIL::ai { enum class OnnxOptimizationLevel { DISABLE_ALL, BASIC, EXTENDED, ALL, }; struct OnnxSessionOptions { int intra_op_num_threads = 1; int inter_op_num_threads = 1; OnnxOptimizationLevel optimization_level = OnnxOptimizationLevel::EXTENDED; bool operator==(const OnnxSessionOptions &) const = default; }; struct FloatTensor { std::vector shape; std::vector values; }; struct NamedFloatTensor { std::string name; FloatTensor tensor; }; class PDJE_API OnnxSession { public: const std::filesystem::path model_path; const OnnxSessionOptions options; const std::vector input_names; const std::vector output_names; explicit OnnxSession(std::filesystem::path model_path, OnnxSessionOptions options = {}); ~OnnxSession(); OnnxSession(OnnxSession &&); OnnxSession & operator=(OnnxSession &&) = delete; OnnxSession(const OnnxSession &) = delete; OnnxSession & operator=(const OnnxSession &) = delete; std::vector run(std::span inputs) const; std::vector run(std::span inputs, std::span requested_output_names) const; private: class Impl; struct Build; explicit OnnxSession(Build build); static Build build(std::filesystem::path model_path, OnnxSessionOptions options); std::unique_ptr impl_; }; } // namespace PDJE_UTIL::ai #include "util/ai/beat_this/BeatThis.hpp"