Commit 3863180d authored by Sergey Shalnov's avatar Sergey Shalnov Committed by Robert Kimball

IntelGPU backend: Relu and Sigmoid datatypes support (#2500)

* IntelGPU backend: Relu and Sigmoid datatypes support

* fix for OpenCL constants

* add const to variables

* PR2500. Style fix
parent d357cb92
......@@ -1083,16 +1083,6 @@ shared_ptr<runtime::Executable>
values.at(0));
break;
}
case OP_TYPEID::Relu:
{
do_cldnn_unary(topology, op, activation_relu);
break;
}
case OP_TYPEID::Sigmoid:
{
do_cldnn_unary(topology, op, activation_logistic);
break;
}
case OP_TYPEID::ReluBackprop:
{
arguments_check(op, 2, 1);
......@@ -1108,88 +1098,104 @@ shared_ptr<runtime::Executable>
}
case OP_TYPEID::Abs:
{
do_universal_unary(topology, op, "fabs", activation_abs);
do_universal_unary(topology, op, "fabs(input_var)", activation_abs);
break;
}
case OP_TYPEID::Sqrt:
{
do_universal_unary(topology, op, "sqrt", activation_sqrt);
do_universal_unary(topology, op, "sqrt(input_var)", activation_sqrt);
break;
}
case OP_TYPEID::Tanh:
{
do_universal_unary(topology, op, "tanh", activation_hyperbolic_tan);
do_universal_unary(topology, op, "tanh(input_var)", activation_hyperbolic_tan);
break;
}
case OP_TYPEID::Sin:
{
do_universal_unary(topology, op, "sin", activation_sin);
do_universal_unary(topology, op, "sin(input_var)", activation_sin);
break;
}
case OP_TYPEID::Asin:
{
do_universal_unary(topology, op, "asin", activation_asin);
do_universal_unary(topology, op, "asin(input_var)", activation_asin);
break;
}
case OP_TYPEID::Sinh:
{
do_universal_unary(topology, op, "sinh", activation_sinh);
do_universal_unary(topology, op, "sinh(input_var)", activation_sinh);
break;
}
case OP_TYPEID::Cos:
{
do_universal_unary(topology, op, "cos", activation_cos);
do_universal_unary(topology, op, "cos(input_var)", activation_cos);
break;
}
case OP_TYPEID::Acos:
{
do_universal_unary(topology, op, "acos", activation_acos);
do_universal_unary(topology, op, "acos(input_var)", activation_acos);
break;
}
case OP_TYPEID::Cosh:
{
do_universal_unary(topology, op, "cosh", activation_cosh);
do_universal_unary(topology, op, "cosh(input_var)", activation_cosh);
break;
}
case OP_TYPEID::Log:
{
do_universal_unary(topology, op, "log", activation_log);
do_universal_unary(topology, op, "log(input_var)", activation_log);
break;
}
case OP_TYPEID::Exp:
{
do_universal_unary(topology, op, "exp", activation_exp);
do_universal_unary(topology, op, "exp(input_var)", activation_exp);
break;
}
case OP_TYPEID::Negative:
{
const cldnn_activation_additional_params param = {-1.f, 0.f};
do_universal_unary(topology, op, "-", activation_linear, param);
do_universal_unary(topology, op, "-(input_var)", activation_linear, param);
break;
}
case OP_TYPEID::Relu:
{
const string zero_const =
"convert_" + get_opencl_type_name(get_output_type(op)) + "(0)";
do_universal_unary(topology, op, "max(" + zero_const + ", input_var)", activation_relu);
break;
}
case OP_TYPEID::Sigmoid:
{
const string one_const = "convert_" + get_opencl_type_name(get_output_type(op)) + "(1)";
do_universal_unary(topology,
op,
one_const + " / (" + one_const + " + exp(-input_var))",
activation_logistic);
break;
}
case OP_TYPEID::Atan:
{
do_custom_unary(topology, op, "atan");
do_custom_unary(topology, op, "atan(input_var)");
break;
}
case OP_TYPEID::Ceiling:
{
do_custom_unary(topology, op, "ceil");
do_custom_unary(topology, op, "ceil(input_var)");
break;
}
case OP_TYPEID::Floor:
{
do_custom_unary(topology, op, "floor");
do_custom_unary(topology, op, "floor(input_var)");
break;
}
case OP_TYPEID::Sign:
{
do_custom_unary(topology, op, "sign");
do_custom_unary(topology, op, "sign(input_var)");
break;
}
case OP_TYPEID::Tan:
{
do_custom_unary(topology, op, "tan");
do_custom_unary(topology, op, "tan(input_var)");
break;
}
case OP_TYPEID::SigmoidBackprop:
......
......@@ -1488,7 +1488,7 @@ void runtime::intelgpu::do_custom_unary_operation(cldnn::topology& topology,
// do the operation with the same type
writer << intermidiate_type << " output_var = " << operation_name
<< "(input_var); //Type: " << get_opencl_type_name(input_type) << "\n";
<< "; //Type: " << get_opencl_type_name(input_type) << "\n";
// convert to destination type
writer << "output" << access_dims(output_shape) << " = convert_"
......
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