Skip to content

AL/math/MaxPooling #407

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

AL/math/MaxPooling #407

wants to merge 7 commits into from

Conversation

Pwhsky
Copy link
Collaborator

@Pwhsky Pwhsky commented Jul 30, 2025

Added docs, torch, tests for math.maxpooling.

@Pwhsky Pwhsky requested review from mirjagranfors and JChonpca July 31, 2025 08:17
Copy link
Collaborator

@mirjagranfors mirjagranfors left a comment

Choose a reason for hiding this comment

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

I have written some comments.

When I tried the example from the docs, I don't get the output that is written in the docs. So double check that.

And when I try to run the exact same example, but swapping numpy for torch, it doesn't work. Therefore I think that you should either make it work exactly the same for both cases, or write a clear example on what is different.

Related to that: for the torch version to work, the shapes have to be different from when running it with numpy. I can imagine that it might lead to problems when a pipeline has been created with numpy, and the user wants to run it with torch, and then gets a different result or that it doesn't work at all anymore. Maybe this is something to discuss in our next meeting.

feature = math.MaxPooling(ksize=2)
pooled_image = feature.resolve(input_image)
self.assertTrue(np.all(pooled_image == [[6.0, 8.0]]))


# Extending the test and setting the backend to torch
@unittest.skipUnless(TORCH_AVAILABLE, "PyTorch is not installed.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can see that you haven't created the layout like this. However, it looks different from how we have done it in test_features.py for example. I personally prefer the style we use in test_feature, as all tests belonging to one class are within the same "def test_....()"

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