Commit a9158a66 authored by Jaikrishnan Menon's avatar Jaikrishnan Menon

CPU: Implement op::Exp

parent c1d0e594
...@@ -1499,3 +1499,22 @@ void Emitter::EMITTER_DECL(EmitSum) ...@@ -1499,3 +1499,22 @@ void Emitter::EMITTER_DECL(EmitSum)
throw ngraph_error("Sum: only vectors and matrices are currently supported"); throw ngraph_error("Sum: only vectors and matrices are currently supported");
} }
} }
void Emitter::EMITTER_DECL(EmitExp)
{
const element::Type& et =
(dynamic_pointer_cast<const TensorViewType>(n->get_arguments().at(0)->get_value_type()))
->get_element_type();
TU +=
" {\n"
" auto arg0 = call_frame->get_tensor_view_data<" + element_type_names[TI(et)] + ">(" +
to_string(inputs[0].get_index()) + ");\n"
" auto out = call_frame->get_tensor_view_data<" + element_type_names[TI(et)] + ">(" +
to_string(outputs[0].get_index()) + ");\n"
" EigenArray1d<" + element_type_names[TI(et)] + ">(out, "
EIGEN_VECTOR_FORMAT(outputs[0].get_layout<DenseTensorViewLayout>()->get_size()) ") =\n"
" EigenArray1d<" + element_type_names[TI(et)] + ">(arg0, "
EIGEN_VECTOR_FORMAT(inputs[0].get_layout<DenseTensorViewLayout>()->get_size()) ").exp();\n"
" }\n";
}
...@@ -83,6 +83,7 @@ namespace ngraph ...@@ -83,6 +83,7 @@ namespace ngraph
void EMITTER_DECL(EmitSign); void EMITTER_DECL(EmitSign);
void EMITTER_DECL(EmitSlice); void EMITTER_DECL(EmitSlice);
void EMITTER_DECL(EmitSum); void EMITTER_DECL(EmitSum);
void EMITTER_DECL(EmitExp);
}; };
} }
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "ngraph/ops/divide.hpp" #include "ngraph/ops/divide.hpp"
#include "ngraph/ops/dot.hpp" #include "ngraph/ops/dot.hpp"
#include "ngraph/ops/equal.hpp" #include "ngraph/ops/equal.hpp"
#include "ngraph/ops/exp.hpp"
#include "ngraph/ops/function_call.hpp" #include "ngraph/ops/function_call.hpp"
#include "ngraph/ops/get_tuple_element.hpp" #include "ngraph/ops/get_tuple_element.hpp"
#include "ngraph/ops/greater.hpp" #include "ngraph/ops/greater.hpp"
...@@ -119,6 +120,7 @@ static const OpMap dispatcher{ ...@@ -119,6 +120,7 @@ static const OpMap dispatcher{
{TI(ngraph::op::Sign), &Emitter::EmitSign}, {TI(ngraph::op::Sign), &Emitter::EmitSign},
{TI(ngraph::op::Slice), &Emitter::EmitSlice}, {TI(ngraph::op::Slice), &Emitter::EmitSlice},
{TI(ngraph::op::Sum), &Emitter::EmitSum}, {TI(ngraph::op::Sum), &Emitter::EmitSum},
{TI(ngraph::op::Exp), &Emitter::EmitExp},
}; };
#undef TI #undef TI
......
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