Metadata-Version: 2.1
Name: torchmocks
Version: 0.0.2
Summary: Mocks pytorch modules so that test run faster
Project-URL: Homepage, https://github.com/nathanbreitsch/torchmocks
Author: Nathan Breitsch
License: MIT
License-File: LICENSE
Keywords: deep learning,machine learning,neural networks,scientific computations,torchmocks
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: torch
Description-Content-Type: text/markdown

# torchmocks
Test pytorch code with minimal computational overhead.

## Problem
The computational overhead of neural networks discourages thorough testing during development and within CI/CD pipelines.

## Solution
Torchmocks replaces common building blocks (such as torch.nn.Conv2d) with replicas that only keep track of tensor shapes and device location.  This is often the only information that we need to check to ensure proper function of pytorch code.

## Example
```python
import torch
import torchmocks
from torchvision.models import resnet152

def test_mock_resnet():
    net = resnet152()
    torchmocks.mock(net)
    image_batch = torch.zeros(4, 3, 255, 255)
    output = net(image_batch)
    assert output.shape == (4, 1000)

```

## Status
This is a work in progress and only a handful of torch modules have been mocked. Modules that have not been mocked will run their normal computation during the forward and backward pass.