[API Compatiblity] add mean, Tensor.mean#74955
Merged
Merged
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
zhwesky2010
reviewed
Aug 28, 2025
| @@ -108,9 +116,18 @@ def mean( | |||
| >>> print(out4.numpy()) | |||
| [ 8.5 12.5 16.5] | |||
| """ | |||
Contributor
There was a problem hiding this comment.
只用处理 dtype != None的情况,减少非必要的判断
7a817fb to
6895a04
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #74955 +/- ##
==========================================
Coverage ? 92.85%
==========================================
Files ? 2
Lines ? 14
Branches ? 0
==========================================
Hits ? 13
Misses ? 1
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
zhwesky2010
reviewed
Aug 29, 2025
| if not isinstance(dtype, (core.VarDesc.VarType, core.DataType)): | ||
| dtype = convert_np_dtype_to_dtype_(dtype) | ||
| if x.dtype != dtype: | ||
| x = cast_(x, dtype) |
Contributor
There was a problem hiding this comment.
这里非inplace的API就用cast,inplace的API用cast_,之前修改的同学有些也改错了。一起更正下吧。
| # 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. |
Contributor
There was a problem hiding this comment.
这些单测case直接加到原来的test_mean_op里去吧
| np.testing.assert_allclose(result.numpy(), expected, rtol=1e-05) | ||
|
|
||
| @skip_if_xpu_or_onednn_and_not_float32('float64') | ||
| def test_all_parameters_combination(self): |
6895a04 to
de2afce
Compare
SigureMo
previously approved these changes
Aug 29, 2025
b53ce8a
b53ce8a to
437a633
Compare
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.
PR Category
User Experience
PR Types
New features
Description
paddle.mean, paddle.Tensor.mean支持dtype和out参数。未下沉至c++实现。