Correlation module for pytorch
Project description
Correlation module
this is a custom C++/Cuda implementation of Correlation module, used e.g. in FlowNetC
This tutorial was used as a basis for implementation.
- Build and Install C++ and CUDA extensions by executing
python setup.py install
, - Benchmark C++ vs. CUDA by running
python benchmark.py {cpu, cuda}
, - Run gradient checks on the code by running
python grad_check.py --backend {cpu, cuda}
.
Requirements
This module is expected to compile for Pytorch 0.4.1
, on Python > 3.5
and Python 2.7
.
Installation
this module is available on pip
pip install spatial-correlation-sampler
Benchmark
- default parameters are from
benchmark.py
, FlowNetC parameters are same as use inFlowNetC
with a batch size of 4, described in this paper, implemented here and here. - Feel free to file an issue to add entries to this with your hardware !
CUDA Benchmark
- See here for a benchmark script working with NVIDIA's code, and Pytorch
0.3
. - Benchmark are launched with environment variable
CUDA_LAUNCH_BLOCKING
set to1
. - Only
float32
is benchmarked.
implementation | Correlation parameters | device | pass | min time | avg time |
---|---|---|---|---|---|
ours | default | 980 GTX | forward | 24.912 ms | 25.202 ms |
ours | default | 980 GTX | backward | 148.341 ms | 148.827 ms |
NVIDIA | default | 980 GTX | forward | 80.743 ms | 81.534 ms |
NVIDIA | default | 980 GTX | backward | 423.968 ms | 425.396 ms |
ours | FlowNetC | 980 GTX | forward | 6.888 ms | 7.578 ms |
ours | FlowNetC | 980 GTX | backward | 28.558 ms | 28.984 ms |
NVIDIA | FlowNetC | 980 GTX | forward | 8.640 ms | 8.805 ms |
NVIDIA | FlowNetC | 980 GTX | backward | 75.757 ms | 76.873 ms |
CPU Benchmark
- No other implementation is avalaible on CPU.
Correlation parameters | device | pass | min time | avg time |
---|---|---|---|---|
default | E5-2630 v3 @ 2.40GHz | forward | 618.303 ms | 626.618 ms |
default | E5-2630 v3 @ 2.40GHz | backward | 1052.563 ms | 1083.407 ms |
FlowNetC | E5-2630 v3 @ 2.40GHz | forward | 339.769 ms | 354.526 ms |
FlowNetC | E5-2630 v3 @ 2.40GHz | backward | 776.335 ms | 785.781 ms |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for spatial_correlation_sampler-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | adcd9846cbd0ed12717dd24e144bfe4813a6a7d59ac460fb97549cd44465fb4e |
|
MD5 | e91c5163a7fb006e477273c92cc975d8 |
|
BLAKE2b-256 | b02bf1d8d71a695f31e8d2f59ec9ec5824ecf3e253cf799c821b4c2067e392b2 |