{"library":"openvino-dev","title":"OpenVINO Development Tools","description":"OpenVINO™ Development Tools (openvino-dev) is Intel's comprehensive toolkit for optimizing and deploying AI models for inference across various Intel hardware. It includes the OpenVINO™ Runtime, Model Optimizer, and Post-Training Optimization Tool. The current version is 2024.6.0. Intel typically releases major updates quarterly, providing a consistent cadence of new features and performance improvements.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install openvino-dev"],"cli":null},"imports":["from openvino.runtime import Core","from openvino.runtime import Model","from openvino.runtime import CompiledModel","from openvino import convert_model","from openvino.runtime import Type","from openvino.runtime import opset12"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import openvino as ov\nimport numpy as np\nimport os\n\n# 1. Create a Core object\ncore = ov.Core()\n\n# 2. Define a simple model programmatically (e.g., a single addition operation)\n# This avoids external files and frameworks for a minimal example.\ninput_a = ov.opset12.parameter([1, 3, 224, 224], ov.Type.f32, name=\"input_a\")\ninput_b = ov.opset12.parameter([1, 3, 224, 224], ov.Type.f32, name=\"input_b\")\nresult_op = ov.opset12.add(input_a, input_b, name=\"add_result\")\nmodel = ov.Model([result_op], [input_a, input_b], \"simple_add_model\")\n\n# 3. Compile the model for a specific device (e.g., 'CPU', 'GPU', 'NPU')\n# Use 'AUTO' to let OpenVINO select the best available device.\ndevice = os.environ.get(\"OPENVINO_DEVICE\", \"CPU\") # Default to CPU\ntry:\n    compiled_model = core.compile_model(model, device)\n    print(f\"Model compiled successfully for {device} device.\")\nexcept RuntimeError as e:\n    print(f\"Warning: Could not compile model for device '{device}': {e}\")\n    print(\"Falling back to CPU if available.\")\n    device = \"CPU\"\n    compiled_model = core.compile_model(model, device)\n\n# 4. Prepare input data\ninput_data_a = np.random.rand(1, 3, 224, 224).astype(np.float32)\ninput_data_b = np.random.rand(1, 3, 224, 224).astype(np.float32)\n\n# 5. Perform inference\n# Inputs can be passed as a list, dictionary, or single tensor depending on model\noutputs = compiled_model([input_data_a, input_data_b])\n\n# 6. Process results\nprint(f\"Inference successful on {device} device.\")\n# The output is a list of numpy arrays, one for each output of the model\nprint(f\"Output shape: {outputs[0].shape}, dtype: {outputs[0].dtype}\")\n","lang":"python","description":"This quickstart demonstrates how to create an OpenVINO Core object, define a simple model programmatically, compile it for a target device, and perform inference. It uses the `openvino.runtime` API introduced in OpenVINO 2023.0+ and avoids external model files or deep learning frameworks for simplicity.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}