.. _Backend: ############### Using ENOT Lite ############### **ENOT Lite** provides a unified interface for running neural network inference with various technologies. To run neural network inference using **ENOT Lite** all you need to do is: #. Create :class:`~enot_lite.backend.backend.Backend` instance by using :func:`~enot_lite.backend.backend_factory.BackendFactory.create` method of :class:`~enot_lite.backend.backend_factory.BackendFactory`. #. Pass your input data into created :class:`~enot_lite.backend.backend.Backend` instance by using :func:`~enot_lite.backend.backend.Backend.__call__` method to obtain prediction. Here is an example which fully covers the basic usage of **ENOT Lite**: .. code-block:: :linenos: from enot_lite.backend import BackendFactory from enot_lite.type import BackendType backend = BackendFactory().create('path/to/model.onnx', BackendType.ORT_CPU) prediction = backend(inputs) * At line **1** in example above we import :class:`~enot_lite.backend.backend_factory.BackendFactory` which will be used to create an instance of :class:`~enot_lite.backend.backend.Backend`. * At line **2** we import :class:`~enot_lite.type.internal.BackendType` which allows to easily choose among various backends. * At line **4** we create :class:`~enot_lite.backend.backend.Backend` instance by using :func:`~enot_lite.backend.backend_factory.BackendFactory.create` method of :class:`~enot_lite.backend.backend_factory.BackendFactory`. Created ``backend`` is a wrap for your model which provides an easy-to-use interface for inference. * And finally, at line **5** inference is done by passing ``inputs`` (it can be images, text or something else) into ``backend`` and the results are stored in ``prediction`` variable. :class:`~enot_lite.type.internal.BackendType` allows you to choose among various inference technologies, so you don't need to do anything special, just create :class:`~enot_lite.backend.backend.Backend` instance by :class:`~enot_lite.backend.backend_factory.BackendFactory` and use it for inference. To refine :class:`~enot_lite.backend.backend.Backend` setting, see :class:`~enot_lite.type.internal.BackendType`, :class:`~enot_lite.type.interface.ModelType`. .. autoclass:: enot_lite.type.BackendType :members: .. autoclass:: enot_lite.type.ModelType :members: .. autoclass:: enot_lite.type.Device :members: .. autoclass:: enot_lite.backend.backend_factory.BackendFactory :members: create .. autoclass:: enot_lite.backend.backend.Backend :members: __call__