未验证 提交 cf629e35 编写于 作者: Z zhupengyang 提交者: GitHub

[XPU] update elemetwise_add, conv and mul ops (#2293)

test=develop
上级 f3e5d3e5
...@@ -136,7 +136,7 @@ node_map_type ConvConverter(const std::shared_ptr<lite::OpLite> op, ...@@ -136,7 +136,7 @@ node_map_type ConvConverter(const std::shared_ptr<lite::OpLite> op,
std::shared_ptr<xtcl::xExpr> add_node = nullptr; std::shared_ptr<xtcl::xExpr> add_node = nullptr;
if (is_channel_bias) { if (is_channel_bias) {
add_node = std::make_shared<xtcl::xExpr>( add_node = std::make_shared<xtcl::xExpr>(
graph_ctx->builder->CreateBiasAdd(*conv_node, *bias_node, 1)); graph_ctx->builder->CreateBiasAdd(*conv_node, 1, *bias_node));
} else { } else {
add_node = std::make_shared<xtcl::xExpr>( add_node = std::make_shared<xtcl::xExpr>(
graph_ctx->builder->CreateBinaryOp("add", *conv_node, *bias_node)); graph_ctx->builder->CreateBinaryOp("add", *conv_node, *bias_node));
......
...@@ -69,7 +69,7 @@ node_map_type ElementwiseConverter(const std::shared_ptr<lite::OpLite> op, ...@@ -69,7 +69,7 @@ node_map_type ElementwiseConverter(const std::shared_ptr<lite::OpLite> op,
std::shared_ptr<xtcl::xExpr> elementwise_node = nullptr; std::shared_ptr<xtcl::xExpr> elementwise_node = nullptr;
if (y_dims.size() == 1) { if (y_dims.size() == 1) {
elementwise_node = std::make_shared<xtcl::xExpr>( elementwise_node = std::make_shared<xtcl::xExpr>(
graph_ctx->builder->CreateBiasAdd(*x_node, *y_node, axis)); graph_ctx->builder->CreateBiasAdd(*x_node, axis, *y_node));
} else if (x_dims.size() == y_dims.size()) { } else if (x_dims.size() == y_dims.size()) {
elementwise_node = std::make_shared<xtcl::xExpr>( elementwise_node = std::make_shared<xtcl::xExpr>(
graph_ctx->builder->CreateBinaryOp("add", *x_node, *y_node)); graph_ctx->builder->CreateBinaryOp("add", *x_node, *y_node));
......
...@@ -78,8 +78,11 @@ node_map_type MulConverter(const std::shared_ptr<lite::OpLite> op, ...@@ -78,8 +78,11 @@ node_map_type MulConverter(const std::shared_ptr<lite::OpLite> op,
// create mul node and set params from op // create mul node and set params from op
std::shared_ptr<xtcl::xExpr> mul_node = nullptr; std::shared_ptr<xtcl::xExpr> mul_node = nullptr;
mul_node = std::make_shared<xtcl::xExpr>(graph_ctx->builder->CreateDense( mul_node = std::make_shared<xtcl::xExpr>(
*x_node, *y_const_node, static_cast<int>(y_dims[1]))); graph_ctx->builder->CreateDense(*x_node,
static_cast<int>(y_dims[1]),
::xtcl::NullValue<::xtcl::DataType>(),
*y_const_node));
graph_ctx->builder->SetLayer(unique_op_type); graph_ctx->builder->SetLayer(unique_op_type);
// output converted nodes // output converted nodes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册