Commit 6b569e6b authored by Shucai Xiao's avatar Shucai Xiao Committed by Ted Themistokleous
Browse files

covert fp16 to fp32 for parsing lrn operator

parent 0d197f27
...@@ -56,7 +56,6 @@ struct parse_generic_op : op_parser<parse_generic_op> ...@@ -56,7 +56,6 @@ struct parse_generic_op : op_parser<parse_generic_op>
{"IsNaN", "isnan"}, {"IsNaN", "isnan"},
{"LeakyRelu", "leaky_relu"}, {"LeakyRelu", "leaky_relu"},
{"Log", "log"}, {"Log", "log"},
{"LRN", "lrn"},
{"Neg", "neg"}, {"Neg", "neg"},
{"Reciprocal", "recip"}, {"Reciprocal", "recip"},
{"Relu", "relu"}, {"Relu", "relu"},
......
#include <migraphx/onnx/op_parser.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/instruction.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace onnx {
struct parse_lrn : op_parser<parse_lrn>
{
std::vector<op_desc> operators() const { return {{"LRN", "lrn"}}; }
instruction_ref parse(const op_desc& opd,
const onnx_parser& parser,
onnx_parser::node_info info,
std::vector<instruction_ref> args) const
{
auto op = parser.load(opd.op_name, info);
auto& arg = args.front();
auto type = arg->get_shape().type();
if(type == shape::half_type)
{
arg =
info.add_instruction(make_op("convert", {{"target_type", shape::float_type}}), arg);
}
auto ret = info.add_instruction(op, arg);
if(type == shape::half_type)
{
ret =
info.add_instruction(make_op("convert", {{"target_type", shape::half_type}}), ret);
}
return ret;
}
};
} // namespace onnx
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
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