-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=develop, test=xpu #7642
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e1afc80
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 1438d1b
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 76508be
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 a14c3e2
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 6abeb30
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 f700779
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 8e98499
[XPU] add conv3d, fix instance_norm, fix conv2d_transpose, test=devel…
wangleilei001 febc048
add conv3d, fix instance_norm, fix conv2d_transpose, test=develop, te…
wangleilei001 fafb30c
add conv3d, fix instance_norm, fix conv2d_transpose, test=develop, te…
wangleilei001 4daf762
add conv3d, fix instance_norm, fix conv2d_transpose, test=develop, te…
wangleilei001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "lite/kernels/xpu/conv3d_compute.h" | ||
#include <vector> | ||
#include "lite/backends/xpu/xpu_header_sitter.h" | ||
#include "lite/core/op_registry.h" | ||
|
||
namespace paddle { | ||
namespace lite { | ||
namespace kernels { | ||
namespace xpu { | ||
|
||
template <> | ||
void Conv3DCompute<PRECISION(kFloat)>::Run() { | ||
auto& param = this->Param<param_t>(); | ||
auto& ctx = this->ctx_->As<XPUContext>(); | ||
|
||
auto& x_dims = param.x->dims(); | ||
auto& w_dims = param.filter->dims(); | ||
int groups = param.groups; | ||
auto& strides = param.strides; | ||
auto paddings = *param.paddings; | ||
auto dilations = *param.dilations; | ||
|
||
int r = xdnn::conv3d<float, float, float, int16_t>( | ||
ctx.GetRawContext(), /* context */ | ||
param.x->data<float>(), | ||
param.filter->data<float>(), /* weight */ | ||
param.output->mutable_data<float>(TARGET(kXPU)), | ||
x_dims[0], /* input_n */ | ||
x_dims[1], /* input_c */ | ||
x_dims[2], /* input_d */ | ||
x_dims[3], /* input_h */ | ||
x_dims[4], /* input_w */ | ||
w_dims[0], /* num_filter */ | ||
std::vector<int>{static_cast<int>(w_dims[2]), | ||
static_cast<int>(w_dims[3]), | ||
static_cast<int>(w_dims[4])}, /* kernel size*/ | ||
strides, | ||
paddings, | ||
dilations, | ||
groups, | ||
nullptr, | ||
nullptr, | ||
nullptr, | ||
true /*is_ncdhw*/); | ||
CHECK_EQ(r, 0); | ||
} | ||
|
||
} // namespace xpu | ||
} // namespace kernels | ||
} // namespace lite | ||
} // namespace paddle | ||
|
||
namespace xpu = paddle::lite::kernels::xpu; | ||
using Conv3dFp32 = xpu::Conv3DCompute<PRECISION(kFloat)>; | ||
|
||
REGISTER_LITE_KERNEL(conv3d, kXPU, kFloat, kNCHW, Conv3dFp32, def) | ||
.BindInput("Input", {LiteType::GetTensorTy(TARGET(kXPU))}) | ||
.BindInput("Bias", {LiteType::GetTensorTy(TARGET(kXPU))}) | ||
.BindInput("Filter", {LiteType::GetTensorTy(TARGET(kXPU))}) | ||
.BindOutput("Output", {LiteType::GetTensorTy(TARGET(kXPU))}) | ||
.BindPaddleOpVersion("conv3d", 1) | ||
.Finalize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include "lite/core/kernel.h" | ||
|
||
namespace paddle { | ||
namespace lite { | ||
namespace kernels { | ||
namespace xpu { | ||
|
||
template <PrecisionType FilterPtype> | ||
class Conv3DCompute : public KernelLite<TARGET(kXPU), FilterPtype> { | ||
public: | ||
using param_t = operators::Conv3DParam; | ||
|
||
virtual void Run(); | ||
|
||
virtual ~Conv3DCompute() = default; | ||
}; | ||
|
||
} // namespace xpu | ||
} // namespace kernels | ||
} // namespace lite | ||
} // namespace paddle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分@chenjiao review下吧