Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f62e169c authored by Miao Wang's avatar Miao Wang Committed by android-build-merger
Browse files

Merge changes from topics "replace_asymm", "fp16-op-add" am: 5a080f41

am: 63fe3b39

Change-Id: Icb3a6d940d146722f695a26e6e8bded975a7614e
parents 73b52ccf 63fe3b39
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -33,15 +33,13 @@ enum OperandType : @1.0::OperandType {
    /**
     * A tensor of 16 bit signed integers that represent real numbers.
     *
     * Attached to this tensor are two numbers that are used to convert the 16
     * bit integer to the real value and vice versa. These two numbers are:
     * - scale: a 32 bit floating point value greater than zero.
     * - zeroPoint: a 32 bit integer, in range [-32768, 32767].
     * Attached to this tensor is a number representing real value scale that is
     * used to convert the 16 bit number to a real value in the following way:
     * realValue = integerValue * scale.
     *
     * The formula is:
     * realValue = (integerValue - zeroPoint) * scale.
     * scale is a 32 bit floating point with value greater then zero.
     */
    TENSOR_QUANT16_ASYMM = 7,
    TENSOR_QUANT16_SYMM = 7,
    /** A tensor of 16 bit floating point values. */
    TENSOR_FLOAT16 = 8,
};
+5 −5
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ static uint32_t getInvalidRank(OperandType type) {
        case OperandType::TENSOR_FLOAT32:
        case OperandType::TENSOR_INT32:
        case OperandType::TENSOR_QUANT8_ASYMM:
        case OperandType::TENSOR_QUANT16_ASYMM:
        case OperandType::TENSOR_QUANT16_SYMM:
            return 0;
        default:
            return 0;
@@ -193,7 +193,7 @@ static float getInvalidScale(OperandType type) {
        case OperandType::TENSOR_INT32:
            return -1.0f;
        case OperandType::TENSOR_QUANT8_ASYMM:
        case OperandType::TENSOR_QUANT16_ASYMM:
        case OperandType::TENSOR_QUANT16_SYMM:
            return 0.0f;
        default:
            return 0.0f;
@@ -225,8 +225,8 @@ static std::vector<int32_t> getInvalidZeroPoints(OperandType type) {
            return {1};
        case OperandType::TENSOR_QUANT8_ASYMM:
            return {-1, 256};
        case OperandType::TENSOR_QUANT16_ASYMM:
            return {-32769, 32768};
        case OperandType::TENSOR_QUANT16_SYMM:
            return {-32769, -1, 1, 32768};
        default:
            return {};
    }
@@ -279,7 +279,7 @@ static void mutateOperand(Operand* operand, OperandType type) {
            newOperand.zeroPoint = 0;
            break;
        case OperandType::TENSOR_QUANT8_ASYMM:
        case OperandType::TENSOR_QUANT16_ASYMM:
        case OperandType::TENSOR_QUANT16_SYMM:
            newOperand.dimensions =
                operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
            newOperand.scale = operand->scale != 0.0f ? operand->scale : 1.0f;