chromium/third_party/tflite/src/tensorflow/lite/nnapi/nnapi_implementation.h

/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_NNAPI_NNAPI_IMPLEMENTATION_H_
#define TENSORFLOW_LITE_NNAPI_NNAPI_IMPLEMENTATION_H_

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <memory>

#include "tensorflow/lite/nnapi/NeuralNetworksTypes.h"

struct NnApi {};

/**
 * Load the NNAPI implementation from the shared libraries.
 * The NnApi structure is filled with all the pointers. If one function doesn't
 * exist, a null pointer is stored.
 */
const NnApi* NnApiImplementation();

// Forward declaration for CreateNnApiFromSupportLibrary below.
struct NnApiSLDriverImplFL5;

/**
 * Allocate a new NnApi structure instance and fill it with function pointers
 * from NnApiSLDriverImplFL5 instance. Functions that are not present in the
 * support library are assigned null pointers.
 *
 * The NN API Support Library Driver must support at least NNAPI Feature Level 5
 * (introduced in SDK level 31), but this might point to a compatible struct
 * that also supports a higher NNAPI Feature Level. These cases can be
 * distinguished by examining the base.implFeatureLevel field, which should be
 * set to the supported feature level (which must be >=
 * ANEURALNETWORKS_FEATURE_LEVEL_5).
 */
std::unique_ptr<const NnApi> CreateNnApiFromSupportLibrary(
    const NnApiSLDriverImplFL5* nnapi_support_library_driver);

#endif  // TENSORFLOW_LITE_NNAPI_NNAPI_IMPLEMENTATION_H_