[Python] numpy 만 사용해서 Gaussian Pooling을 할 수 있는 방법이 있을까요?(되도록이면 for문은 자제하고 싶습니다)
글쓴이: baeusa1 / 작성시간: 수, 2020/02/19 - 11:54오전
matrix: array([[ 20, 200, -5, 23, 10, -50], [ -13, 134, 119, 100, 45, -79], [ 120, 32, 49, 25, 13, 0], [ 40, 12, 59, 23, 32, -1], [ 75, 121, 69, 67, 64, -7], [ 39, 12, 79, -8, 16, -9]]) kernel: array([[ 1/16, 1/8, 1/16], [ 1/8, 1/4, 1/8], [ 1/16, 1/8, 1/16]]) soln: array([[ 87.25, 16.625], [ 64.8125, 29.8125]])
이런식으로 Gaussian Pooling 을 해보고 싶습니다.
Forums:
solution
First transform you M x N matrix into a (M//K) x K x (N//K) x K array, then pointwise multiply with the kernel at the second and fourth dimensions, then sum at the second and fourth dimensions.
댓글 달기