Home | History | Annotate | Download | only in fibonacci
      1 /*
      2  * Copyright (C) 2019 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ANDROID_FRAMEWORKS_ML_NN_EXTENSIONS_TEST_VENDOR_FIBONACCI_FIBONACCI_EXTENSION_H
     18 #define ANDROID_FRAMEWORKS_ML_NN_EXTENSIONS_TEST_VENDOR_FIBONACCI_FIBONACCI_EXTENSION_H
     19 
     20 /**
     21  * A sample extension definition.
     22  *
     23  * Tests are available in
     24  * runtime/test/fibonacci_extension/FibonacciExtensionTest.cpp
     25  */
     26 
     27 const char TEST_VENDOR_FIBONACCI_EXTENSION_NAME[] = "com.example.fibonacci";
     28 
     29 /**
     30  * Quantization parameters for {@link TEST_VENDOR_TENSOR_QUANT64_ASYMM}.
     31  */
     32 typedef struct TestVendorQuant64AsymmParams {
     33     double scale;
     34     int64_t zeroPoint;
     35 } TestVendorQuant64AsymmParams;
     36 
     37 enum {
     38     /**
     39      * A signed 64-bit integer scalar value.
     40      */
     41     TEST_VENDOR_INT64 = 0,
     42 
     43     /**
     44      * A tensor of 64-bit unsigned integers that represent real numbers.
     45      *
     46      * Attached to this tensor is {@link TestVendorQuant64AsymmParams} that is
     47      * used to convert the 64-bit bit integer to the real value and vice versa.
     48      *
     49      * The formula is:
     50      *   real_value = (integer_value - zeroPoint) * scale.
     51      */
     52     TEST_VENDOR_TENSOR_QUANT64_ASYMM = 1,
     53 };
     54 
     55 enum {
     56     /**
     57      * Computes the Fibonacci sequence up to n.
     58      *
     59      * Supported input types:
     60      * - {@link TEST_VENDOR_INT64}
     61      * - {@link ANEURALNETWORKS_TENSOR_FLOAT32} (must contain exactly 1 element)
     62      *
     63      * Supported output types:
     64      * - {@link TEST_VENDOR_TENSOR_QUANT64_ASYMM}
     65      * - {@link ANEURALNETWORKS_TENSOR_FLOAT32}
     66      *
     67      * Inputs:
     68      * * 0: A scalar n.
     69      *
     70      * Outputs:
     71      * * 0: A 1-D tensor of size n.
     72      */
     73     TEST_VENDOR_FIBONACCI = 0,
     74 };
     75 
     76 #endif  // ANDROID_FRAMEWORKS_ML_NN_EXTENSIONS_TEST_VENDOR_FIBONACCI_FIBONACCI_EXTENSION_H
     77