CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【Paddle Tensor No.26】Svdvals new branch #69796
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
【Paddle Tensor No.26】Svdvals new branch #69796
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
17bd7a4
to
46e4219
Compare
@skip_check_grad_ci( | ||
reason="'check_grad' on singular values is not required for svdvals." | ||
) |
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.
这个打开后在aistudio机器上要运行多久呢?
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.
这个打开后在aistudio机器上要运行多久呢?
这个还没测试过来着
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.
这个打开后在aistudio机器上要运行多久呢?
这个还没测试过来着
几百x几百规模的svd应该很快的,几十或者几百毫秒就能跑,你可以打开本地测试一下
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.
这个打开后在aistudio机器上要运行多久呢?
这个还没测试过来着
几百x几百规模的svd应该很快的,几十或者几百毫秒就能跑,你可以打开本地测试一下
好的我本地编译测试一下
|
||
np_s = np.linalg.svd(self.x_np, compute_uv=False, hermitian=False) | ||
for r in res: | ||
self.assertTrue(np.allclose(np_s, r, rtol=1e-6)) |
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.
下个PR把所有的assertTrue(allclose)用np.testing.assert_allclose代替,这样错误信息会更清晰
self.assertTrue(np.allclose(np_s, r, rtol=1e-6)) | |
np.testing.assert_allclose(np_s, r, rtol=1e-6)) |
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.
下个PR把所有的assertTrue(allclose)用np.testing.assert_allclose代替,这样错误信息会更清晰
了解
if in_dynamic_or_pir_mode(): | ||
return _C_ops.svdvals(x) | ||
else: | ||
check_variable_and_dtype(x, 'dtype', ['float32', 'float64'], 'svdvals') | ||
helper = LayerHelper('svdvals', **locals()) | ||
s = helper.create_variable_for_type_inference(dtype=x.dtype) | ||
attrs = {} | ||
helper.append_op( | ||
type='svdvals', | ||
inputs={'X': [x]}, | ||
outputs={'S': s}, | ||
attrs=attrs, | ||
) | ||
return s |
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.
下个PR再把老IR的分支删了
if in_dynamic_or_pir_mode(): | |
return _C_ops.svdvals(x) | |
else: | |
check_variable_and_dtype(x, 'dtype', ['float32', 'float64'], 'svdvals') | |
helper = LayerHelper('svdvals', **locals()) | |
s = helper.create_variable_for_type_inference(dtype=x.dtype) | |
attrs = {} | |
helper.append_op( | |
type='svdvals', | |
inputs={'X': [x]}, | |
outputs={'S': s}, | |
attrs=attrs, | |
) | |
return s | |
return _C_ops.svdvals(x) |
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.
Copilot reviewed 5 out of 17 changed files in this pull request and generated no suggestions.
Files not reviewed (12)
- paddle/cinn/hlir/dialect/operator/ir/op_dialect.cc: Language not supported
- paddle/fluid/pir/dialect/operator/ir/op_dialect.cc: Language not supported
- paddle/fluid/pir/dialect/operator/ir/op_onednn_dialect.cc: Language not supported
- paddle/phi/infermeta/unary.cc: Language not supported
- paddle/phi/infermeta/unary.h: Language not supported
- paddle/phi/kernels/cpu/svdvals_grad_kernel.cc: Language not supported
- paddle/phi/kernels/cpu/svdvals_kernel.cc: Language not supported
- paddle/phi/kernels/impl/svdvals_grad_kernel_impl.h: Language not supported
- paddle/phi/kernels/svdvals_grad_kernel.h: Language not supported
- paddle/phi/kernels/svdvals_kernel.h: Language not supported
- paddle/phi/ops/yaml/backward.yaml: Evaluated as low risk
- paddle/phi/ops/yaml/ops.yaml: Evaluated as low risk
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.
@@ -0,0 +1,158 @@ | |||
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. |
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.
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. | |
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. |
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.
我在下一个pr里更改吧
n = len(op_list_strs) // 4 | ||
first_part_op_info = op_list_strs[:n] | ||
second_part_op_info = op_list_strs[n:] | ||
second_part_op_info = op_list_strs[n : 2 * n] | ||
third_part_op_info = op_list_strs[2 * n : 3 * n] | ||
fourth_part_op_info = op_list_strs[3 * n :] |
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.
n_parts = 4
part_size = math.ceil(len(op_list_strs) / n_part)
op_list_parts = [op_list_strs[part_offset:part_offset + part_size] for part_offset in range(0, len(op_list_strs), part_size)]
后续可以考虑以更易于维护的方式来扩展
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.
n_parts = 4 part_size = math.ceil(len(op_list_strs) / n_part) op_list_parts = [op_list_strs[part_offset:part_offset + part_size] for part_offset in range(0, len(op_list_strs), part_size)]后续可以考虑以更易于维护的方式来扩展
好的谢谢佬
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.
LGTM
PR Category
User Experience
PR Types
New features
Description
【Paddle Tensor No.26】Svdvals new branch
#69082