Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila Namespace Reference

Mila main API namespace. More...

Namespaces

namespace  Core
namespace  Data
namespace  detail
namespace  Dnn
namespace  Logging
namespace  Profiling
namespace  Utils

Classes

struct  Version
 Semantic Version data. More...

Functions

Version Mila::getAPIVersion ()
 Gets the current Mila runtime API version.
bool Mila::initialize (unsigned int randomSeed=0, std::shared_ptr< Logging::Logger > sink=nullptr)
 Initializes the Mila framework.
void Mila::shutdown ()
 Shuts down the Mila framework and releases all resources.

Detailed Description

Mila main API namespace.

Function Documentation

◆ getAPIVersion()

Version Mila::getAPIVersion ( )
export

Gets the current Mila runtime API version.

Returns
A Version object describing the running library.

The version components are injected by the build as PUBLIC compile definitions (see the Versioning block in Mila/CMakeLists.txt), sourced from Version.txt. find_package consumers recompile this module unit and pick the definitions up via the exported target's interface, so no version header is shipped.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize()

bool Mila::initialize ( unsigned int randomSeed = 0,
std::shared_ptr< Logging::Logger > sink = nullptr )
export

Initializes the Mila framework.

Must be called before using any other Mila functionality. If no sink is provided a NullSink is used, suppressing all log output — appropriate for applications linking Mila as a static library that manage their own logging. Pass an explicit sink to opt in to Mila log output.

Parameters
randomSeedRandom seed for reproducibility. 0 = non-deterministic.
sinkLogging sink to register. nullptr = NullSink (silent).
Returns
True if initialization succeeded, false otherwise.
Exceptions
Anyexception thrown during initialization is propagated to the caller; the application is responsible for handling it.
// Silent — appropriate default for apps linking Mila as a library
// Development / CLI tool — opt in to Info-level console output
auto sink = std::make_shared<Mila::Logging::ConsoleSink>( Logging::LogLevel::Info );
Mila::initialize( 0, sink );
// FastAPI server — structured file logging at Warning+
auto sink = std::make_shared<Mila::Logging::FileSink>( "mila.log", Logging::LogLevel::Warning );
Mila::initialize( 0, sink );
@ Warning
Unexpected conditions that do not prevent continued operation.
Definition Logger.ixx:45
@ Info
Normal operational milestones (model loaded, server ready).
Definition Logger.ixx:44
bool initialize(unsigned int randomSeed=0, std::shared_ptr< Logging::Logger > sink=nullptr)
Initializes the Mila framework.
Definition Mila.ixx:309
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown()

void Mila::shutdown ( )
export

Shuts down the Mila framework and releases all resources.

Flushes any pending log output through the registered sink before releasing it. After this call no further log calls should be made until initialize() is called again.

Exceptions
Anyexception thrown during shutdown is propagated to the caller.
Here is the call graph for this function:
Here is the caller graph for this function: