Drop quant_util.h and move helper function into quantization.h (#8747)

This commit is contained in:
Nick Kreeger 2021-08-16 15:08:25 -05:00 committed by GitHub
parent d0ff2621ee
commit 93e1e1dfa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 24 deletions

View file

@ -5,7 +5,7 @@
#include "core/providers/cpu/math/gemm_base.h"
#include "core/providers/cpu/math/gemm_helper.h"
#include "core/providers/cpu/math/matmul_integer_base.h"
#include "core/quantization/quant_util.h"
#include "core/quantization/quantization.h"
#include "core/util/math_cpuonly.h"
namespace onnxruntime {

View file

@ -4,7 +4,7 @@
#include "core/framework/op_kernel.h"
#include "core/mlas/inc/mlas.h"
#include "core/providers/common.h"
#include "core/quantization/quant_util.h"
#include "core/quantization/quantization.h"
namespace onnxruntime {

View file

@ -1,22 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "core/common/common.h"
#include "core/mlas/inc/mlas.h"
#include "core/framework/allocator.h"
#include "core/framework/buffer_deleter.h"
namespace onnxruntime {
namespace quantization {
// Transpose the input and store it to a new allocated buffer
inline uint8_t* TransPoseInputData(const uint8_t* input, BufferUniquePtr& buffer_holder, AllocatorPtr& allocator, size_t M, size_t N) {
uint8_t* output = static_cast<uint8_t*>(allocator->Alloc(M * N * sizeof(uint8_t)));
MlasTranspose(input, output, M, N);
buffer_holder.reset(output);
return output;
}
} // namespace quantization
} // namespace onnxruntime

View file

@ -186,5 +186,17 @@ void Dequantize(const std::vector<T>& values,
Dequantize(values.data(), output.data(), params, values.size());
}
// Transpose the input and store it to a new allocated buffer.
inline uint8_t* TransPoseInputData(const uint8_t* input,
BufferUniquePtr& buffer_holder,
AllocatorPtr& allocator,
size_t M,
size_t N) {
uint8_t* output = static_cast<uint8_t*>(allocator->Alloc(M * N * sizeof(uint8_t)));
MlasTranspose(input, output, M, N);
buffer_holder.reset(output);
return output;
}
} // namespace quantization
} // namespace onnxruntime