Commit 4d9c1812 authored by nishant.b.patel's avatar nishant.b.patel

Add codegen support

parent 51dc51eb
......@@ -189,10 +189,18 @@ namespace ngraph
auto scale_index = mkldnn_emitter->get_scale_index<OP>();
auto scales_size = shape_size(node->get_input_shape(scale_index));
writer << "std::vector<float> dyn_scales;\n";
writer << "dyn_scales.assign(" << args[scale_index].get_name() << ", "
<< args[scale_index].get_name() << " + " << std::to_string(scales_size)
<< ");\n";
if (is_same<OP, ngraph::op::QuantizedConvolution>())
{
writer << "dyn_scales.push_back(*" << args[2].get_name() << " * "
<< " * " << args[4].get_name() << " / "
<< " * " << args[6].get_name() << ");\n";
}
else
{
writer << "dyn_scales.assign(" << args[scale_index].get_name() << ", "
<< args[scale_index].get_name() << " + " << std::to_string(scales_size)
<< ");\n";
}
// for Quantize
if (is_same<OP, ngraph::op::Quantize>())
{
......@@ -2206,11 +2214,9 @@ namespace ngraph
auto result_shape = out[0].get_shape();
auto scales_size = shape_size(node->get_input_shape(2));
writer << "std::vector<float> dyn_scales;\n";
writer << "dyn_scales.assign(" << args[2].get_name() << ", "
<< args[2].get_name() << " + " << std::to_string(scales_size) << ");\n";
writer << "reference::convolution<" << out[0].get_type() << ">("
writer << "reference::convolution<" << args[0].get_type() << " , "
<< args[1].get_type() << " , " << out[0].get_type() << ", int32_t>("
<< args[0].get_name() << ",\n";
writer << " " << args[1].get_name() << ",\n";
writer << " " << out[0].get_name() << ",\n";
......@@ -2227,7 +2233,12 @@ namespace ngraph
<< "},\n";
writer << " {"
<< join(convolution->get_data_dilation_strides()) << "}, \n";
writer << " dyn_scales[0]);\n";
writer << " " << args[2].get_name() << ",\n";
writer << " " << args[3].get_name() << ",\n";
writer << " " << args[4].get_name() << ",\n";
writer << " " << args[5].get_name() << ",\n";
writer << " " << args[6].get_name() << ",\n";
writer << " " << args[7].get_name() << ");\n";
}
}
......
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