From 0a9895d9b75562f8e9f7269e7812537925bb681d Mon Sep 17 00:00:00 2001 From: Lev Proleev Date: Fri, 12 Apr 2019 17:29:33 +0100 Subject: [PATCH] Fix docs: clarify usage of float16 scalars in operations Update the docs for ops: - LOG_SOFTMAX - LOCAL_RESPONSE_NORMALIZATION The docs mentioned possibility to use float16 as an input type but didn't specify that other inputs must be float16 as well in that case. Fix: 123500722 Test: mma Change-Id: I9028c4a109c80f0b8571fab45555818e9e4bc783 Merged-In: I9028c4a109c80f0b8571fab45555818e9e4bc783 (cherry picked from commit 6d13ba258b0fe7c4e89c11b565aff461080c5e04) --- current.txt | 2 +- neuralnetworks/1.2/types.hal | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/current.txt b/current.txt index 8157c94263..e9fdde7f7b 100644 --- a/current.txt +++ b/current.txt @@ -451,7 +451,7 @@ b83317b66721241887d2770b5ae95fd5af1e77c5daa7530ecb08fae8892f2b43 android.hardwar 92714960d1a53fc2ec557302b41c7cc93d2636d8364a44bd0f85be0c92927ff8 android.hardware.neuralnetworks@1.2::IExecutionCallback 36e1064c869965dee533c537cefbe87e54db8bd8cd45be7e0e93e00e8a43863a android.hardware.neuralnetworks@1.2::IPreparedModel e1c734d1545e1a4ae749ff1dd9704a8e594c59aea7c8363159dc258e93e0df3b android.hardware.neuralnetworks@1.2::IPreparedModelCallback -b47700929d91ad9c037fd26077d4008d4a04753f71f4f332aeedbd1de7bb91e1 android.hardware.neuralnetworks@1.2::types +73e995644b1bb2678ec3ab850feb7a1b4495501953951c22316cefd67b900b3e android.hardware.neuralnetworks@1.2::types cf7a4ba516a638f9b82a249c91fb603042c2d9ca43fd5aad9cf6c0401ed2a5d7 android.hardware.nfc@1.2::INfc abf98c2ae08bf765db54edc8068e36d52eb558cff6706b6fd7c18c65a1f3fc18 android.hardware.nfc@1.2::types 4cb252dc6372a874aef666b92a6e9529915aa187521a700f0789065c3c702ead android.hardware.power.stats@1.0::IPowerStats diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index 499c817348..087249abf5 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -1005,12 +1005,21 @@ enum OperationType : int32_t { * the input. * * 1: An {@link OperandType::INT32} scalar, specifying the radius of * the normalization window. - * * 2: An {@link OperandType::FLOAT32} scalar, specifying the bias, must - * not be zero. - * * 3: An {@link OperandType::FLOAT32} scalar, specifying the scale - * factor, alpha. - * * 4: An {@link OperandType::FLOAT32} scalar, specifying the exponent, - * beta. + * * 2: A scalar, specifying the bias, must not be zero. + * For input tensor of {@link OperandType::TENSOR_FLOAT16}, the bias + * value must be of {@link OperandType::FLOAT16}. + * For input tensor of {@link OperandType::TENSOR_FLOAT32}, the bias + * value must be of {@link OperandType::FLOAT32}. + * * 3: A scalar, specifying the scale factor, alpha. + * For input tensor of {@link OperandType::TENSOR_FLOAT16}, the alpha + * value must be of {@link OperandType::FLOAT16}. + * For input tensor of {@link OperandType::TENSOR_FLOAT32}, the alpha + * value must be of {@link OperandType::FLOAT32}. + * * 4: A scalar, specifying the exponent, beta. + * For input tensor of {@link OperandType::TENSOR_FLOAT16}, the beta + * value must be of {@link OperandType::FLOAT16}. + * For input tensor of {@link OperandType::TENSOR_FLOAT32}, the beta + * value must be of {@link OperandType::FLOAT32}. * * 5: An optional {@link OperandType::INT32} scalar, default to -1, * specifying the dimension normalization would be performed on. * Negative index is used to specify axis from the end (e.g. -1 for @@ -3495,8 +3504,12 @@ enum OperationType : int32_t { * * Inputs: * * 0: A tensor specifying the input logits. - * * 1: An {@link OperandType::FLOAT32} scalar, specifying the positive - * scaling factor for the exponent, beta. + * * 1: A scalar, specifying the positive scaling factor for the exponent, + * beta. + * For input tensor of {@link OperandType::TENSOR_FLOAT16}, the beta + * value must be of {@link OperandType::FLOAT16}. + * For input tensor of {@link OperandType::TENSOR_FLOAT32}, the beta + * value must be of {@link OperandType::FLOAT32}. * * 2: An {@link OperandType::INT32} scalar specifying the axis to * reduce across. Negative index is used to specify axis from the * end (e.g. -1 for the last axis). Must be in the range [-n, n).