提交 148fafe8 编写于 作者: Z zhaocai 提交者: MaxwellDing

add relu6 op

上级 118de038
...@@ -73,6 +73,9 @@ REGISTER_SUBGRAPH_BRIDGE(sigmoid, ...@@ -73,6 +73,9 @@ REGISTER_SUBGRAPH_BRIDGE(sigmoid,
kMLU, kMLU,
paddle::lite::subgraph::mlu::ActConverter); paddle::lite::subgraph::mlu::ActConverter);
REGISTER_SUBGRAPH_BRIDGE(relu, kMLU, paddle::lite::subgraph::mlu::ActConverter); REGISTER_SUBGRAPH_BRIDGE(relu, kMLU, paddle::lite::subgraph::mlu::ActConverter);
REGISTER_SUBGRAPH_BRIDGE(relu6,
kMLU,
paddle::lite::subgraph::mlu::ActConverter);
REGISTER_SUBGRAPH_BRIDGE(tanh, kMLU, paddle::lite::subgraph::mlu::ActConverter); REGISTER_SUBGRAPH_BRIDGE(tanh, kMLU, paddle::lite::subgraph::mlu::ActConverter);
REGISTER_SUBGRAPH_BRIDGE(leaky_relu, REGISTER_SUBGRAPH_BRIDGE(leaky_relu,
kMLU, kMLU,
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
// limitations under the License. // limitations under the License.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <random> #include <random>
#include "lite/core/op_lite.h" #include "lite/core/op_lite.h"
#include "lite/core/op_registry.h" #include "lite/core/op_registry.h"
#include "lite/kernels/mlu/bridges/test_helper.h" #include "lite/kernels/mlu/bridges/test_helper.h"
...@@ -134,7 +136,8 @@ void test_act(std::vector<int64_t> x_shape, std::string op_type) { ...@@ -134,7 +136,8 @@ void test_act(std::vector<int64_t> x_shape, std::string op_type) {
TEST(MLUBridges, activation) { TEST(MLUBridges, activation) {
std::vector<std::vector<int64_t>> shapes{{1}, {2, 3}, {1, 2, 3, 4}}; std::vector<std::vector<int64_t>> shapes{{1}, {2, 3}, {1, 2, 3, 4}};
std::vector<std::string> types{"sigmoid", "relu", "tanh", "leaky_relu"}; std::vector<std::string> types{
"sigmoid", "relu", "relu6", "tanh", "leaky_relu"};
for (auto x_shape : shapes) { for (auto x_shape : shapes) {
for (auto op_type : types) { for (auto op_type : types) {
test_act(x_shape, op_type); test_act(x_shape, op_type);
...@@ -149,5 +152,6 @@ TEST(MLUBridges, activation) { ...@@ -149,5 +152,6 @@ TEST(MLUBridges, activation) {
USE_SUBGRAPH_BRIDGE(sigmoid, kMLU) USE_SUBGRAPH_BRIDGE(sigmoid, kMLU)
USE_SUBGRAPH_BRIDGE(relu, kMLU) USE_SUBGRAPH_BRIDGE(relu, kMLU)
USE_SUBGRAPH_BRIDGE(relu6, kMLU)
USE_SUBGRAPH_BRIDGE(tanh, kMLU) USE_SUBGRAPH_BRIDGE(tanh, kMLU)
USE_SUBGRAPH_BRIDGE(leaky_relu, kMLU) USE_SUBGRAPH_BRIDGE(leaky_relu, kMLU)
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#pragma once #pragma once
USE_SUBGRAPH_BRIDGE(relu, kMLU); USE_SUBGRAPH_BRIDGE(relu, kMLU);
USE_SUBGRAPH_BRIDGE(relu6, kMLU)
USE_SUBGRAPH_BRIDGE(conv2d, kMLU); USE_SUBGRAPH_BRIDGE(conv2d, kMLU);
USE_SUBGRAPH_BRIDGE(depthwise_conv2d, kMLU); USE_SUBGRAPH_BRIDGE(depthwise_conv2d, kMLU);
USE_SUBGRAPH_BRIDGE(elementwise_add, kMLU); USE_SUBGRAPH_BRIDGE(elementwise_add, kMLU);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册