हमारा सुझाव है कि 27 मार्च, 2025 से AOSP को बनाने और उसमें योगदान देने के लिए, aosp-main के बजाय android-latest-release का इस्तेमाल करें. ज़्यादा जानकारी के लिए, AOSP में हुए बदलाव लेख पढ़ें.
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Android 10 में, Neural Networks API (NNAPI) के फ़ंक्शन उपलब्ध हैं. इनकी मदद से, मशीन लर्निंग फ़्रेमवर्क लाइब्रेरी और ऐप्लिकेशन, उपलब्ध डिवाइसों के बारे में जानकारी पा सकते हैं. साथ ही, यह भी तय कर सकते हैं कि किसी मॉडल को किन डिवाइसों पर चलाना है. उपलब्ध डिवाइसों के बारे में जानकारी देने से, ऐप्लिकेशन को डिवाइस पर मौजूद ड्राइवर का सटीक वर्शन मिल जाता है. इससे, ऐप्लिकेशन के काम न करने की समस्या से बचा जा सकता है. ऐप्लिकेशन को यह तय करने की सुविधा देकर कि किन डिवाइसों को मॉडल के अलग-अलग सेक्शन को लागू करना है, ऐप्लिकेशन को उस प्रॉडक्ट के लिए ऑप्टिमाइज़ किया जा सकता है जिस पर उन्हें डिप्लॉय किया गया है.
एनएन एचएएल 1.2 को लागू करने के लिए, डिवाइस खोजने और असाइनमेंट की सुविधा ज़रूरी है.
लागू करना
NNAPI में डिवाइस डिस्कवरी और असाइनमेंट की सुविधाओं का इस्तेमाल करने के लिए, IDevice.hal में getType और getVersionString लागू करें. इससे फ़्रेमवर्क को डिवाइस टाइप और ड्राइवर वर्शन का पता चल पाएगा.
हर डिवाइस के लिए, टाइप को इनमें से किसी एक कैटगरी के तौर पर बताएं, जैसा कि types.hal में DeviceType में बताया गया है.
OTHER: ऐसा डिवाइस जो किसी भी अन्य कैटगरी में नहीं आता. इसमें अलग-अलग तरह के इंटरफ़ेस शामिल हैं. यह एक ऐसा IDeviceइंटरफ़ेस है जो अलग-अलग तरह के कई डिवाइसों को मैनेज करता है. अलग-अलग इंटरफ़ेस वाले ड्राइवर को अलग-अलग IDevice इंटरफ़ेस भी दिखाने चाहिए, ताकि ऐप्लिकेशन उन डिवाइसों में से किसी एक को चुन सके.
CPU: सिंगल कोर या मल्टीकोर सीपीयू.
GPU: ऐसा जीपीयू जो NNAPI मॉडल चला सकता है और OpenGL ES और Vulkan जैसे ग्राफ़िक एपीआई को तेज़ कर सकता है.
ACCELERATOR: खास तौर पर डिज़ाइन की गई न्यूरल प्रोसेसिंग यूनिट (एनपीयू).
डिवाइस पर लागू करने की वर्शन स्ट्रिंग पाने के लिए, IDevice.hal में getVersionString लागू करें.
इस तरीके से ऐसी स्ट्रिंग दिखनी चाहिए जिसे कोई भी व्यक्ति आसानी से पढ़ सके. स्ट्रिंग का फ़ॉर्मैट, वेंडर के हिसाब से होता है. ड्राइवर के हर नए वर्शन के लिए, वर्शन स्ट्रिंग अलग-अलग होनी चाहिए.
IDevice इंटरफ़ेस का नाम, {VENDOR}-{DEVICE_NAME} के फ़ॉर्मैट में होना चाहिए.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Device discovery and assignment\n\n| **Deprecated:** Starting in Android 15, the\n| [NNAPI (NDK API)](https://developer.android.com/ndk/guides/neuralnetworks) is deprecated. The Neural Networks HAL interface\n| continues to be supported.\n|\n| For more information, see the\n| [NNAPI Migration Guide](https://developer.android.com/ndk/guides/neuralnetworks/migration-guide).\n\nIn Android 10, the\n[Neural Networks API (NNAPI)](/docs/core/interaction/neural-networks)\nintroduces functions that allow\nmachine learning framework\nlibraries and apps to get information about the devices available and\nspecify which devices to execute a model on. Providing information about the\navailable devices allows apps to get the exact version of the drivers\nfound on the device to avoid known incompatibilities. By giving apps the\nability to specify which devices are to execute different sections of a model,\napps can be optimized for the product on which they are deployed.\n\nSupport for device discovery and assignment is required for NN HAL 1.2\nimplementations.\n\nImplementation\n--------------\n\nTo support the device discovery and assignment features in NNAPI, implement\n[`getType`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/neuralnetworks/1.2/IDevice.hal#76)\nand\n[`getVersionString`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/neuralnetworks/1.2/IDevice.hal#56)\nin `IDevice.hal` to allow the framework to get the device type and driver\nversion.\n\nFor each device, specify the type as one of the following categories as\nspecified in\n[`DeviceType`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/neuralnetworks/1.2/types.hal#4737)\nin\n[`types.hal`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/neuralnetworks/1.2/types.hal).\n\n- **`OTHER`:** A device that doesn't fall into any of the other categories, including a heterogeneous interface, which is a single `IDevice` interface that manages multiple devices, possibly of different types. A driver with a heterogeneous interface should also expose separate `IDevice` interfaces that correspond to individual devices to allow an application to choose from those devices.\n- **`CPU`:** A single core or multicore CPU.\n- **`GPU`:** A GPU that can run NNAPI models and accelerate graphics APIs such as OpenGL ES and Vulkan.\n- **`ACCELERATOR`:** A dedicated neural processing unit (NPU).\n\nImplement\n[`getVersionString`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/neuralnetworks/1.2/IDevice.hal#56)\nin `IDevice.hal` for getting the version string of the device implementation.\nThis method must return a string that is human readable. The format of the\nstring is vendor specific. The version string must be different for each new\nversion of a driver.\n\nThe name of the `IDevice` interface must follow the `{VENDOR}-{DEVICE_NAME}`\nformat."]]