Repository navigation
AL/math/MaxPooling - #407
Conversation
mirjagranfors
left a comment
There was a problem hiding this comment.
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.
| retaining the most significant features. | ||
|
|
||
| If the backend is NumPy, the downsampling is performed using | ||
| `skimage.measure.block_reduce`. |
| If the backend is NumPy, the downsampling is performed using | ||
| `skimage.measure.block_reduce`. | ||
| If the backend is PyTorch, the downsampling | ||
| is performed using `torch.nn.functional.max_pool2d`. |
There was a problem hiding this comment.
use the full line before new line
|
|
||
| Examples | ||
| -------- | ||
| >>> import deeptrack as dt |
| The pooled input as `NDArray` or `torch.Tensor` depending on | ||
| the backend. | ||
|
|
||
| """ |
| """ | ||
| if self.get_backend() == "numpy": | ||
| return self._get_numpy(image, ksize, **kwargs) | ||
| elif self.get_backend() == "torch": |
There was a problem hiding this comment.
restructure like we did for min-pooling
|
|
||
| Parameters | ||
| ---------- | ||
| image: NDArray |
| Kernel size of the pooling operation. | ||
|
|
||
| Returns | ||
| ------- |
Added docs, torch, tests for math.maxpooling.