Open
Conversation
Contributor
|
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
mosout
reviewed
Apr 22, 2024
mosout
reviewed
Apr 25, 2024
| void Compute(user_op::KernelComputeContext* ctx, user_op::OpKernelState*, | ||
| const user_op::OpKernelCache* cache) const override { | ||
| // process context data | ||
| auto input = ctx->Tensor4ArgNameAndIndex("in", 0); |
Contributor
There was a problem hiding this comment.
不可变对象比如in要用const auto*,可变对象比如tmp_buffer要用auto*,下面类似的地方都要这样
| .SetIsMatchedHob(user_op::HobDeviceType() == DeviceType::kCUDA \ | ||
| && user_op::HobEnvBool("ONEFLOW_KERNEL_ENABLE_CUDNN_V8", false)) \ | ||
| .SetInferTmpSizeFn([](user_op::InferContext* ctx) -> size_t { \ | ||
| auto& input = ctx->InputTensorDesc("in", 0); \ |
|
|
||
| private: | ||
| void Compute(user_op::KernelComputeContext* ctx) const override { | ||
| auto input = ctx->Tensor4ArgNameAndIndex("x", 0); |
| .SetIsMatchedHob(user_op::HobDeviceType() == DeviceType::kCUDA | ||
| && user_op::HobEnvBool("ONEFLOW_KERNEL_ENABLE_CUDNN_V8", false)) | ||
| .SetInferTmpSizeFn([](user_op::InferContext* ctx) -> size_t { | ||
| auto& input = ctx->InputTensorDesc("x", 0); |
Contributor
|
另外还有很多地方用了auto,可以看一下能加const的都加上const,部分函数声明中的参数在函数体中是不可变的也都加const& |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.