-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Fix paddle.mode and paddle.bincount API #63970
Merged
kangguangli
merged 7 commits into
PaddlePaddle:develop
from
xingmingyyj:fix_mode_bincount
May 9, 2024
Merged
Fix paddle.mode and paddle.bincount API #63970
kangguangli
merged 7 commits into
PaddlePaddle:develop
from
xingmingyyj:fix_mode_bincount
May 9, 2024
Conversation
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
你的PR提交成功,感谢你对开源项目的贡献! |
补充说明bincount报错信息: ......
paddle.seed(33)
obj = naive_func
dy_out = obj(in_tensor, in_params, func)
paddle.seed(33)
jit_obj = paddle.jit.to_static(obj)
st_out = jit_obj(in_tensor, in_params, func)
print("dy_out is: ", dy_out)
print("st_out is: ", st_out)
paddle.jit.save(jit_obj, path="bincount")
print("jit.save is successfully !!!")
paddle.seed(33)
jit = paddle.jit.load("bincount")
print("jit.load is successfully !!!")
paddle.seed(33)
inputs_key = sorted(in_tensor.keys())
inputs_value = []
for k in inputs_key:
inputs_value.append(in_tensor[k])
# print('inputs_value is: ', inputs_value)
res = jit(*inputs_value)
print('jit.load res: ', res)
compare(dy_out, res, delta=1e-5, rtol=1e-6) 报错如下:
这里可以发现在scale这算子中,张量的实际数据类型和目前期望的数据类型不一致。
猜测时infermeta中的dtype设置问题导致的。这里weight为空,x.dtype为int32,所以被设置为了int32类型,和kernel中的下述逻辑不符。 if (!has_weights) {
int64_t* output_data = dev_ctx.template Alloc<int64_t>(output);
phi::funcs::SetConstant<Context, int64_t>()(
dev_ctx, output, static_cast<int64_t>(0));
KernelBincount<T, InputT, int64_t>
<<<GET_BLOCKS(input_numel), PADDLE_CUDA_NUM_THREADS, 0, stream>>>(
input_data, input_numel, has_weights, weights_data, output_data);
} |
kangguangli
previously approved these changes
Apr 30, 2024
kangguangli
approved these changes
May 9, 2024
co63oc
pushed a commit
to co63oc/Paddle
that referenced
this pull request
May 10, 2024
* fix_infermeta * Update binary.cc * Update binary.cc * Update binary.cc * Update binary.cc * Update binary.cc * ci
co63oc
pushed a commit
to co63oc/Paddle
that referenced
this pull request
May 11, 2024
* fix_infermeta * Update binary.cc * Update binary.cc * Update binary.cc * Update binary.cc * Update binary.cc * ci
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.
PR Category
Others
PR Types
Bug fixes
Description
paddle.mode和paddle.bincount两个API在静态图模式下组网执行时,出现精度问题。经过分析原因和 #62801 所遇到的问题一致,根据kernel中的数据类型进行修复。