Comments (2)
Pytorch has AdaptivePooling implementation here:
https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/native/AdaptivePooling.h
https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/native/cpu/AdaptiveAvgPoolKernel.cpp
If the input size is an integer multiple of the output for your case, the adaptive max pooling can be replaced by max pooling from oneDNN.
the stride and kernel size can be pre-calculated from input and output size, like:
stride = kernel = input size/ output size.
but, if the input size is not an integer multiple of the output, the current oneDNN max pooling can not product the exactly the same output with AdaptivePooling:
See the bellow code which is similar with Pytorch on steps/kernel computation for adaptive pooling,
inline int start_index(int a, int b, int c) {
return (a / b) * c + ((a % b) * c) / b;
}
inline int end_index(int a, int b, int c) {
return 1 + ((a + 1) * c - 1) / b;
}
int main() {
int osize = 6;
int isize = 10;
for (int oh = 0; oh < osize; ++oh) {
int istart = start_index(oh, osize, isize);
int iend = end_index(oh, osize, isize);
int k = iend - istart;
std::cout << "oh: " << oh << ", istart: " << istart << ", iend: " << iend << ", kernel: " << k << std::endl;
}
return 0;
}
the stride and kernel change when input size is not an integer multiple of ouput in some cases.
For example, when input size is 10, output is 6:
oh: 0, istart: 0, iend: 2, kernel: 2
oh: 1, istart: 1, iend: 4, kernel: 3
oh: 2, istart: 3, iend: 5, kernel: 2
oh: 3, istart: 5, iend: 7, kernel: 2
oh: 4, istart: 6, iend: 9, kernel: 3
oh: 5, istart: 8, iend: 10, kernel: 2
from onednn.
ths
from onednn.
Related Issues (20)
- Use of use_buffer_b pointer in brgemm matrix multiplication HOT 6
- Min and max reduction in a single prim execution HOT 3
- Add official support for sparse memory and sparse-dense matmul HOT 4
- Branching and release scheme HOT 4
- Why dnnl_gemm_bf16bf16f32 is much slower than dnnl_sgemm? HOT 2
- Question about verbose output HOT 3
- Request for Explanation of values set to some variables in jit_avx512_common_conv_kernel.cpp HOT 2
- build failure in aarch64 with ACL HOT 3
- test_benchdnn_matmul_ci_cpu fails on aarch64 with and without the Compute Library backend HOT 12
- How to print out Memory Descriptors and other stuff? HOT 2
- GEMM API for efficient LLM inference with W8A16 HOT 3
- How scales work in oneDNN HOT 9
- Static builds with ONEDNN_VERBOSE=OFF produce undefined symbol: dnnl::impl::rt_mds2str HOT 1
- Builds with ONEDNN_ENABLE_MAX_CPU_ISA=OFF crash HOT 2
- accuracy issue in a graph conv test HOT 2
- create memory with tag::any,it crash HOT 3
- bibtex ref about oneDNN HOT 4
- Understand oneDNN graph compiler HOT 7
- Difference between BRGEMM in oneDNN and GEMM in openBLAS HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onednn.