<commit_before>PyINN
=====

CuPy implementations of fused PyTorch ops.

PyTorch version of [imagine-nn](https://github.com/szagoruyko/imagine-nn)

The purpose of this package is to contain CUDA ops written in Python
with CuPy, which is not a PyTorch dependency.

An alternative to CuPy would be <https://github.com/pytorch/extension-ffi>,
but it requires a lot of wrapping code like <https://github.com/sniklaus/pytorch-extension>,
so doesn't really work with quick prototyping.

Another advantage of CuPy over C code is that dimensions of each op
are known at JIT-ing time, and compiled kernels potentially can be faster.
Also, the first version of the package was in PyCUDA, but it can't work with
PyTorch multi-GPU.


## Documentation 

### conv2d_depthwise

Implements depthwise convolution as in <https://arxiv.org/abs/1704.04861>
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications

CUDA kernels from https://github.com/BVLC/caffe/pull/5665
<commit_msg>add example in README<commit_after>PyINN
=====

CuPy implementations of fused PyTorch ops.

PyTorch version of [imagine-nn](https://github.com/szagoruyko/imagine-nn)

The purpose of this package is to contain CUDA ops written in Python
with CuPy, which is not a PyTorch dependency.

An alternative to CuPy would be <https://github.com/pytorch/extension-ffi>,
but it requires a lot of wrapping code like <https://github.com/sniklaus/pytorch-extension>,
so doesn't really work with quick prototyping.

Another advantage of CuPy over C code is that dimensions of each op
are known at JIT-ing time, and compiled kernels potentially can be faster.
Also, the first version of the package was in PyCUDA, but it can't work with
PyTorch multi-GPU.


## Installation

```
pip install git+https://github.com/szagoruyko/pyinn.git@master
```

## Example

```python
import torch
from torch.autograd import Variable
import pyinn as P
x = Variable(torch.randn(1,4,5,5).cuda())
w = Variable(torch.randn(4,1,3,3).cuda())
y = P.conv2d_depthwise(x, w, padding=1)
```

TODO: add modules interface.

## Documentation 

### conv2d_depthwise

Implements depthwise convolution as in <https://arxiv.org/abs/1704.04861>
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications

CUDA kernels from https://github.com/BVLC/caffe/pull/5665

{'fraction_non_alphanumeric': 0.09075268817204302, 'fraction_numerical': 0.016344086021505378, 'mean_word_length': 4.786069651741293, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7600260', 'n_tokens_mistral': 785, 'n_tokens_neox': 720, 'n_words': 269}