Commit e7abc0f3 authored by Chris Sullivan's avatar Chris Sullivan Committed by Robert Kimball

Added op::Relu and op::Not to GPU transformer and enabled corresponding tests (#641)

* Added op::Relu and op::Not and enabled corresponding tests.

* Removed softmax for now.
parent a86a9050
......@@ -45,6 +45,8 @@ namespace ngraph
class GreaterEq;
class Less;
class LessEq;
class Not;
class Relu;
class Max;
class Min;
class Negative;
......@@ -250,6 +252,20 @@ namespace ngraph
static constexpr const char* op = "less_equal";
static constexpr const char* math_kernel = "x0 <= x1";
};
template <>
struct CudaOpMap<ngraph::op::Relu>
{
static constexpr const char* op = "relu";
static constexpr const char* math_kernel = "fmaxf(0,x0)";
};
template <>
struct CudaOpMap<ngraph::op::Not>
{
static constexpr const char* op = "not";
static constexpr const char* math_kernel = "!x0";
};
}
}
}
......@@ -231,7 +231,7 @@ static const runtime::gpu::OpMap dispatcher{
{TI(ngraph::op::Product), &runtime::gpu::GPU_Emitter::emit<ngraph::op::Product>},
{TI(ngraph::op::Max), &runtime::gpu::GPU_Emitter::emit<ngraph::op::Max>},
{TI(ngraph::op::Min), &runtime::gpu::GPU_Emitter::emit<ngraph::op::Min>},
{TI(ngraph::op::Relu), &runtime::gpu::GPU_Emitter::emit<ngraph::op::Relu>},
{TI(ngraph::op::Relu), &runtime::gpu::GPU_Emitter::EmitElementwise},
{TI(ngraph::op::ReluBackprop), &runtime::gpu::GPU_Emitter::emit<ngraph::op::ReluBackprop>},
{TI(ngraph::op::Softmax), &runtime::gpu::GPU_Emitter::emit<ngraph::op::Softmax>},
};
......
......@@ -4868,7 +4868,6 @@ TEST(${BACKEND_NAME}, max_pool_2d_1channel_1image_strided)
TEST(${BACKEND_NAME}, not)
{
SKIP_TEST_FOR("GPU", "${BACKEND_NAME}");
Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::boolean, shape);
auto f = make_shared<Function>(make_shared<op::Not>(A), op::ParameterVector{A});
......@@ -8285,7 +8284,6 @@ TEST(${BACKEND_NAME}, min_3d_eliminate_zero_dim)
TEST(${BACKEND_NAME}, relu_2Dfprop)
{
SKIP_TEST_FOR("GPU", "${BACKEND_NAME}");
auto shape_a = Shape{2, 5};
auto A = make_shared<op::Parameter>(element::f32, shape_a);
auto relu = make_shared<op::Relu>(A);
......@@ -8308,7 +8306,6 @@ TEST(${BACKEND_NAME}, relu_2Dfprop)
TEST(${BACKEND_NAME}, relu_4Dfprop)
{
SKIP_TEST_FOR("GPU", "${BACKEND_NAME}");
auto shape_a = Shape{2, 2, 2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape_a);
auto relu = make_shared<op::Relu>(A);
......@@ -8331,7 +8328,6 @@ TEST(${BACKEND_NAME}, relu_4Dfprop)
TEST(${BACKEND_NAME}, fuse_max_with_constant_zero_input_as_relu)
{
SKIP_TEST_FOR("GPU", "${BACKEND_NAME}");
auto shape_a = Shape{2, 5};
auto A = op::Constant::create(element::f32, shape_a, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
auto B = make_shared<op::Parameter>(element::f32, shape_a);
......
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