The purpose of the MathEngine class is to isolate the algorithms library from the implementation of the low-level platform-dependent operations. It is used in blob, layers, and neural network.

class neoml.MathEngine.MathEngine(internal)

The base class for a math engine that does calculations.


Releases all temporary resources allocated for the current thread.

property peak_memory_usage

The peak memory usage achieved during processing.

class neoml.MathEngine.CpuMathEngine(thread_count=None)

A math engine working on CPU.


thread_count (int, default=None) – the maximum number of threads in use.

class neoml.MathEngine.GpuMathEngine(gpu_index=None)

A math engine working on GPU.


gpu_index (int, >= 0 or None) – the index of the GPU on which you wish to work. Use the enum_gpu method to get the list. Use None for auto-selection.

property info

Gets the device information.


Lists the available GPUs.


Creates a default CPU math engine that uses only one processing thread and has no memory limitations.