Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boydad/pytorch_conv4D
https://github.com/boydad/pytorch_conv4D
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/boydad/pytorch_conv4D
- Owner: boydad
- Created: 2020-11-02T16:17:41.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T14:07:06.000Z (5 months ago)
- Last Synced: 2024-07-04T00:57:30.570Z (4 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyTorch conv4D
The repository contains a four-dimensional convolutional layer for the PyTorch framework. The implementation of the 4D convolutions layer is done as a set of 3D convolutional layers. Up to my best knowledge first implementation of this idea [was done for TensorFlow](https://github.com/funkey/conv4d) where one can see some explanations. For PyTorch, there are implementations by [Timothy Gebhard](https://github.com/timothygebhard/pytorch-conv4d) and [Josué Page Vizcaíno](https://github.com/pvjosue/pytorch_convNd).
The current repository aims to speed up naive implementations. Using broadcasting one can decrease the number of calls of 3D convolutions layers up to kernel size in the fourth direction. Using the `group` parameter one can decrease the number of calls even further. In the repository, two implementations are implemented and they show different performance. For example, for testing parameters, these implementations show 20% - 50% worse speed than PyTorch implementation, and much better than naive implementation(code is written in such a way that it uses Nd - 1 Pytorch convolution layers and, therefore, can be compared with Pytorch implementation in 3D). However, for a different set of parameters performance will be different.
The code is written only for `stride=1`, `dilation=1`, `groups=1` and zero or circular padding. Tests were done only for a specific set of parameters and no guarantee can be done. Before running add tests for your parameters in `test_conv4d.py`, to run tests use `pytest`. Performance measurement can be done with `ppython -m pytorch_conv4D.test_conv4d`.
The code was tested using Nvidia GPUs and PyTorch 1.4.