Skip to content

Conversation

@chAwater
Copy link
Contributor

Notes

  • [Why make this PR] At first, I just want the export function for PointwiseAvgPool, then I found the 3D and 2D are in separate files with similar codes, so I start to merge them
  • [How] I just copy-paste the code and remove duplicates, and made small modifications refer to pointwise_max.py
  • [Test] I run the tests with python -m unittest test/nn/test_pooling.py and python -m unittest test/nn/test_export.py
  • I'm not familiar with the Antialiased part, so I labeled it with review comment
  • This change might affect Give devs the flexibility to control PointwiseAvgPoolAntialiased2D output #36
  • Sorry that my IDE automatically removed whitespace in blank lines, I hope this is ok

Contents

  • Move pointwise_avg_3d.py into pointwise_avg.py - 388af7f
  • Add export (with tests) for PointwiseAvgPool2D and PointwiseAvgPool3D - 71967fa, 630de18
  • Fix missing ceil_mode in export of PointwiseMaxPool2D and PointwiseMaxPool3D - 655a059

chAwater added 4 commits July 18, 2023 18:36
Signed-off-by: chenhe <chenhe@megarobo.tech>
Signed-off-by: chenhe <chenhe@megarobo.tech>
Signed-off-by: chenhe <chenhe@megarobo.tech>
Signed-off-by: chenhe <chenhe@megarobo.tech>
Comment on lines 265 to +275
filter_size = 2*int(round(3*sigma))+1

self.kernel_size = (filter_size, filter_size)

if isinstance(stride, int):
self.stride = (stride, stride)
elif stride is None:
self.stride = self.kernel_size
else:
self.stride = stride

if stride is None:
stride = filter_size

if padding is None:
padding = int((filter_size-1)//2)

if isinstance(padding, int):
self.padding = (padding, padding)
else:
self.padding = padding

# Build the Gaussian smoothing filter
super(_PointwiseAvgPoolAntialiasedND, self).__init__(
in_type, d, filter_size, stride, padding
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with the Antialiased part, especially the kernel_size you have mentioned in #36 (comment)
So I'm not sure this modification is compatible with your later plan for implementation.

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.

1 participant