Skip to content

zhaohui-yang/XNORnet-PyTorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XNORnet

XNOR-net implementation using PyTorch.


|Dataset| Network | 1bit | 32bit | Acc of XNOR | Acc of 32bit|
|-------|---------|------|-------|-------------|-------------|
|MNIST  | LeNet5  | 0.425| 0.007 | 99.30       | 99.34       |
|CIFAR10| NIN     | 0.949| 0.025 | 86.16       | 89.67       |

Implementation

Pack XNORConv2d and XNORLinear as two modules, you can add them any where you want. Remember to call the following function after loss.backward()

        for layer in model.children():
            if isinstance(layer, XNORConv2d) or isinstance(layer, XNORLinear):
                layer.copy_grad()

MNIST

Main function modified from pytorch examples. BNN is sensitive to hyper-parameters, so be patience!

Network structure based on LeNet5.

CIFAR10

Network structure based on NIN

Acknowlegement

Thanks to jiecaoyu's implementation XNOR-Net-PyTorch

About

Pack XNOR modules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages