Commit e490557c authored by Anna Alberska's avatar Anna Alberska Committed by Scott Cyphers

IntelGPU backend: Select operation support for double (#2762)

* select op add types

* add a test for double for select

* Update intelgpu_op_custom_kernels.cpp
parent a2829ba2
......@@ -1229,10 +1229,13 @@ CustomKernels::krnl_info CustomKernels::build_krnl(const shared_ptr<op::Select>&
{
const string& input0_name = op->get_input_tensor_name(0);
const Shape& input0_shape = op->get_input_shape(0);
const element::Type& input0_type = op->get_input_element_type(0);
const string& input1_name = op->get_input_tensor_name(1);
const Shape& input1_shape = op->get_input_shape(1);
const element::Type& input1_type = op->get_input_element_type(1);
const string& input2_name = op->get_input_tensor_name(2);
const Shape& input2_shape = op->get_input_shape(2);
const element::Type& input2_type = op->get_input_element_type(2);
const string& output_name = op->get_output_tensor_name(0);
const Shape& output_shape = op->get_output_shape(0);
const element::Type& output_type = op->get_output_element_type(0);
......@@ -1242,9 +1245,11 @@ CustomKernels::krnl_info CustomKernels::build_krnl(const shared_ptr<op::Select>&
gen_func_def(writer,
entry_point_name,
{"char", "float", "float"},
{get_opencl_type_name(input0_type),
get_opencl_type_name(input1_type),
get_opencl_type_name(input2_type)},
{input0_shape, input1_shape, input2_shape},
"float",
get_opencl_type_name(output_type),
output_shape);
writer.block_begin();
......
......@@ -1329,6 +1329,31 @@ NGRAPH_TEST(${BACKEND_NAME}, select)
MIN_FLOAT_TOLERANCE_BITS));
}
NGRAPH_TEST(${BACKEND_NAME}, select_double)
{
Shape shape{2, 2, 2};
auto A = make_shared<op::Parameter>(element::boolean, shape);
auto B = make_shared<op::Parameter>(element::f64, shape);
auto C = make_shared<op::Parameter>(element::f64, shape);
auto f = make_shared<Function>(make_shared<op::Select>(A, B, C), ParameterVector{A, B, C});
auto backend = runtime::Backend::create("${BACKEND_NAME}");
// Create some tensors for input/output
auto a = backend->create_tensor(element::boolean, shape);
copy_data(a, vector<char>{0, 1, 1, 0, 0, 1, 0, 1});
auto b = backend->create_tensor(element::f64, shape);
copy_data(b, vector<double>{1, 2, 3, 4, 5, 6, 7, 8});
auto c = backend->create_tensor(element::f64, shape);
copy_data(c, vector<double>{11, 12, 13, 14, 15, 16, 17, 18});
auto result = backend->create_tensor(element::f64, shape);
auto handle = backend->compile(f);
handle->call_with_validate({result}, {a, b, c});
EXPECT_TRUE(test::all_close_f((vector<double>{11, 2, 3, 14, 15, 6, 17, 8}),
read_vector<double>(result)));
}
NGRAPH_TEST(${BACKEND_NAME}, tensor_constant)
{
Shape shape{2, 2, 2};
......
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