GithubHelp home page GithubHelp logo

canesin / bnn_kernel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brycexu/bnn_kernel

0.0 0.0 0.0 1.05 MB

This is a BNN_Kernel on PyTorch for 1-bit networks in image data processing

Shell 0.31% C++ 33.18% Python 23.40% C 33.81% Cuda 7.77% Makefile 1.53%

bnn_kernel's Introduction

Description

In theory, Binarized Neural Networks boast of x32 compression and x10 acceleration on GPUs. However, all variables are stored and manipulated in the form of float-32 on PyTorch. In this case, if we want to implement 1-bit networks on PyTorch, we have to change the kernel.

This repository contains a wrapped CUDA kernel that supports both 1-bit storage and computation on PyTorch

How to use

check the environment

GCC:     >=5.0
PyTorch: <1.0
PyThon:  >=3.5
CUDA:    >=8.0

build the kernel

GPU

cd ./csrc/binop
make

CPU

cd ./csrc/binop_cpu
make

check the API and use

GPU

import torch
import binop
...

CPU

import torch
import binop_cpu

References

How to wrap a CUDA and use its functions in PyTorch:

Pytorch Custom CUDA kernel Tutorial

Examples

You can see the GPU example in test

You can see the CPU example in test

bnn_kernel's People

Contributors

brycexu avatar

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.