- Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatiblity] add mean, Tensor.mean #74955
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
Conversation
| 你的PR提交成功,感谢你对开源项目的贡献! |
| >>> out4 = paddle.mean(x, axis=[0, 2]) | ||
| >>> print(out4.numpy()) | ||
| [ 8.5 12.5 16.5] | ||
| """ |
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.
只用处理 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:
|
python/paddle/tensor/stat.py Outdated
| if not isinstance(dtype, (core.VarDesc.VarType, core.DataType)): | ||
| dtype = convert_np_dtype_to_dtype_(dtype) | ||
| if x.dtype != dtype: | ||
| x = cast_(x, dtype) |
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.
这里非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. |
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.
这些单测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): |
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.
反向也跑下吧
6895a04 to de2afce Compare 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
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
b53ce8a b53ce8a to 437a633 Compare 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.mean, paddle.Tensor.mean支持dtype和out参数。未下沉至c++实现。