27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main yerine android-latest-release kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Android 10'da Neural Networks API (NNAPI), makine öğrenimi çerçevesi kitaplıklarının ve uygulamalarının mevcut cihazlar hakkında bilgi almasına ve bir modelin hangi cihazlarda çalışacağını belirtmesine olanak tanıyan işlevler sunar. Mevcut cihazlar hakkında bilgi sağlamak, bilinen uyumsuzlukları önlemek için uygulamaların cihazda bulunan sürücülerin tam sürümünü almasına olanak tanır. Uygulamalara, bir modelin farklı bölümlerinin hangi cihazlarda çalışacağını belirtme olanağı sunarak uygulamaları dağıtıldıkları ürün için optimize edebilirsiniz.
NN HAL 1.2 uygulamaları için cihaz keşfi ve atama desteği gereklidir.
Uygulama
NNAPI'deki cihaz keşfi ve atama özelliklerini desteklemek için çerçevenin cihaz türünü ve sürücü sürümünü almasına izin vermek üzere IDevice.hal içinde getType ve getVersionString uygulayın.
Her cihaz için türü, types.hal bölümündeki DeviceType bölümünde belirtildiği gibi aşağıdaki kategorilerden biri olarak belirtin.
OTHER: Muhtemelen farklı türde birden fazla cihazı yöneten tek bir IDevicearayüzü olan heterojen arayüz de dahil olmak üzere diğer kategorilerin hiçbirine girmeyen bir cihaz. Heterojen bir arayüze sahip sürücü, uygulamanın bu cihazlar arasından seçim yapmasına izin vermek için ayrı cihazlara karşılık gelen ayrı IDevice arayüzleri de sunmalıdır.
CPU: Tek çekirdekli veya çok çekirdekli CPU.
GPU: NNAPI modellerini çalıştırabilen ve OpenGL ES ile Vulkan gibi grafik API'lerini hızlandırabilen bir GPU.
ACCELERATOR: Özel bir sinir işlem birimi (NPU).
Cihaz uygulama sürüm dizesini almak için IDevice.hal içinde getVersionString uygulayın.
Bu yöntem, kullanıcıların okuyabileceği bir dize döndürmelidir. Dizenin biçimi satıcıya özgüdür. Sürüm dizesi, sürücünün her yeni sürümü için farklı olmalıdır.
IDevice arayüzünün adı {VENDOR}-{DEVICE_NAME} biçimine uygun olmalıdır.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 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."]]