"test/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "0861bb2a2a650940a8d87fcb744fbd124bb43b92"
Commit 351b43b7 authored by Umang Yadav's avatar Umang Yadav
Browse files

remove unnecessary changes

parent 9e2946a4
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <migraphx/eliminate_data_type.hpp>
#include <migraphx/module.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/ranges.hpp>
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <migraphx/ref/lowering.hpp> #include <migraphx/ref/lowering.hpp>
#include <migraphx/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/dfor.hpp> #include <migraphx/dfor.hpp>
#include <migraphx/op/identity.hpp> #include <migraphx/op/identity.hpp>
#include <migraphx/op/convolution.hpp> #include <migraphx/op/convolution.hpp>
...@@ -308,46 +307,19 @@ struct ref_quant_gemm ...@@ -308,46 +307,19 @@ struct ref_quant_gemm
{ {
argument result{output_shape}; argument result{output_shape};
// first, convert the args[0] and args[1] from int8_t to int32_t // first, convert the args[0] and args[1] from int8_t to int32_t
argument arg_0{{output_shape.type(), {args.at(0).get_shape().lens()}}}; argument arg_0{{shape::int32_type, {args.at(0).get_shape().lens()}}};
argument arg_1{{output_shape.type(), {args.at(1).get_shape().lens()}}}; argument arg_1{{shape::int32_type, {args.at(1).get_shape().lens()}}};
if(output_shape.type() == migraphx::shape::float_type) arg_0.visit([&](auto output) {
{ args.at(0).visit(
arg_0.visit([&](auto output) { [&](auto input) { std::copy(input.begin(), input.end(), output.begin()); });
args.at(0).visit([&](auto input) { });
std::transform(input.begin(), input.end(), output.begin(), [&](const auto x) {
return static_cast<float>(x);
});
});
});
arg_1.visit([&](auto output) { arg_1.visit([&](auto output) {
args.at(1).visit([&](auto input) { args.at(1).visit(
std::transform(input.begin(), input.end(), output.begin(), [&](const auto x) { [&](auto input) { std::copy(input.begin(), input.end(), output.begin()); });
return static_cast<float>(x); });
});
});
});
migemm(result, arg_0, arg_1, 1.0f, 0.0f);
}
else if(output_shape.type() == migraphx::shape::int32_type)
{
arg_0.visit([&](auto output) {
args.at(0).visit([&](auto input) {
std::transform(input.begin(), input.end(), output.begin(), [&](const auto x) {
return static_cast<int32_t>(x);
});
});
});
arg_1.visit([&](auto output) { migemm(result, arg_0, arg_1, int32_t{1}, int32_t{0});
args.at(1).visit([&](auto input) {
std::transform(input.begin(), input.end(), output.begin(), [&](const auto x) {
return static_cast<int32_t>(x);
});
});
});
migemm(result, arg_0, arg_1, int32_t{1}, int32_t{0});
}
return result; return result;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment