Skip to content

fix: A new feature for NDArray.max #1091

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

Merged
merged 3 commits into from
Jun 5, 2023
Merged

Conversation

RayWang-iat
Copy link
Contributor

Solve the problem that NDArray.max() does not support max from multiple dimensions and add a TestMethod. #635

And the NDArray.sum() method has already supported max from multiple dimensions.

Thanks!

@RayWang-iat RayWang-iat requested a review from Oceania2018 as a code owner June 2, 2023 15:36
@RayWang-iat RayWang-iat changed the title fix:NDArray.max not accepting int array of axis fix:NDArray.max not accepting int array of axis#635 Jun 2, 2023
@RayWang-iat RayWang-iat changed the title fix:NDArray.max not accepting int array of axis#635 fix: A new feature for NDArray.max Jun 2, 2023
@RayWang-iat RayWang-iat closed this Jun 2, 2023
@RayWang-iat RayWang-iat reopened this Jun 2, 2023
var x1 = new NDArray(new[,] { { 1, 2, 3 }, { 4, 5.1, 6 } });
var x2 = new NDArray(new[,] { { 3, 2, 1 }, { 6, 5.1, 4 } });
var y = np.maximum(x1,x2);
var y1 = np.maximum(x1, x2, axis: 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.
Can you add one more testing case

np.maximum(x1, x2, axis: 1)

var y3 = new NDArray(new[,] { { 3, 2, 3 }, { 6, 5.1, 6 } });
var y4 = new NDArray(new[] { 6, 5.1, 6 });
var y5 = new NDArray(new[] { 3.0, 6 });
Assert.AreEqual(y0, y3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the simplier syntax like: Assert.AreEqual(new[,] { { 3, 2, 3 }, { 6, 5.1, 6 } }, y0.numpy());

@Oceania2018 Oceania2018 merged commit f45b35b into SciSharp:master Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants