Giter Club home page Giter Club logo

sign-symmetry's Introduction

This pacakge implements PyTorch ResNet & AlexNet models that support two asymmetric feedback learning algorithms:

To use different weights in forward and backward passes, we needed to modify the backward() routine. Since the interface to backward() in torch.nn.Conv2d is not exposed to Python, it is necessary to implement a custom convolution autograd.Function. This is achieved by borrowing routines from torch.legacy.nn.SpatialConvolution that expose separate forward/backward interfaces but still use C libraries to carry out the computations efficiently. Then, a custom Conv2d module is defined with the custom Conv2d Function and used to construct ResNet models by customizing torchvision/models/resnet.py to replace standard Conv2d layers with the custom version. In this implementation, batch-norm and pooling layers continue to use backprop, but in our experience this does not affect performance.

In addition, a training script for ImageNet is included modified from this one. The command line arguments --algo and --lalgo control the algorithm used for convolutional layers and the last layer, respectively (only implemented for ResNet and AlexNet). By default, sign-symmetry is used for the convlutional layers and backpropagation is used for the last layer. Another option is added to use batch-manhattan SGD (Liao, Leibo, & Poggio, 2016) in place of standard SGD because it was previously found to improve training with sign-symmetry. It is implemented by extending torch.optim.SGD.

It should be relatively straightforward to extend this package to support other network architectures.

sign-symmetry's People

Contributors

bergeron1900 avatar fmarcinek avatar kkulczak avatar willwx avatar

Watchers

 avatar  avatar

Forkers

fmarcinek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.