Giter Club home page Giter Club logo

hasktorch's Introduction

hasktorch

Build Status

Hasktorch is a library for tensors and neural networks in Haskell. It is an independent open source community project which leverages the core C libraries shared by Torch and PyTorch. This library leverages cabal new-build and backpack.

Note that this project is in early development and should only be used by contributing developers. Expect substantial changes to the library API as it evolves. Contributions and PRs are welcome (see details below).

Project Organization

In order of high-to-low level. The reverse order can also be seen in the cabal.project file.

Directory Description
examples/ Examples of basic usage and experimental prototypes from a simple hasktorch-core dependency
core/ Reexports of all typeclasses (see classes/) and instances (see indef/)
dimensions/ Reexports and helpers of the dimensions library
classes/ Typeclasses and helpers which consist of a user-friendly Haskell API
indef/ Orphan instances of the above typeclasses for the relevant backpack signatures
signatures/ Backpack signatures which line up with the generated C-FFI
types/ Memory-managed tensors and core data types that satisfy global and type-specific backpack types
raw/ Comprehensive raw bindings to C operations (TH, THNN, THC, THCUNN)
codegen/ Code generation to produce low-level raw Haskell bindings
output/ Staging directory for codegen/ output, contents should not be under source control
vendor/ 3rd party dependencies as git submodules (links to ATen and, possibly, other libraries)

Build Instructions

Currently hasktorch only supports OSX and Linux builds because these are what the development team works on -- if you would like to add *BSD or Windows support, please let us know!

Building Hasktorch requires retrieving and building a fork of pytorch's ATen library dependency. Currently (04/12/2018), we fork ATen to reintroduce some C-native broadcasting functionality which was moved to ATen's C++ core. This step has been condensed in our Makefile as make init.

Following this, you will need cabal-install > 2.0 for new-build and backpack support. If you would like to new-run the examples on the command line (instead of dropping into a new-repl) you will need to build off of the cabal's head (here's the current commit). If this seems intimidating, wait for backpack support in stack.

Ensure that libATen.so is on your library path. This can be done by sourcing the setenv file or configuring cabal from ~/.cabal/config. Now you can build hasktorch:

cabal new-build all
cabal new-run static-tensor-usage

To build without GPU support/CUDA, use:

cabal new-build all --flags=-cuda
cabal new-run static-tensor-usage --flags=-cuda

For more development tips, see DEVELOPERS.md and review the vendor/ readme for details on external dependencies.

Getting started

For an example of basic end-user API usage, see the statically typed tensor usage example and the example of simple gradient descent.

For details on implementation and usage of raw C bindings and the core library, refer to their respective README documentation in raw/ and core/ package directories. Additional examples can be found in examples/ as well as the test modules.

Contributing

We welcome new contributors. For a rough list of outstanding items on deck (there are many places to contribute), refer to:

https://github.com/hasktorch/hasktorch/projects/1

Contact Austin Huang or Sam Stites for access to the hasktorch slack channel. You can find our contact information by digging through cabal files or you can ping us on gitter in the DataHaskell Lobby.

Thanks

Thanks to all hasktorch developers who have contributed to this community effort so far. This project is also indebted to prior work on typed functional programming for deep learning by Justin Le , Edward Yang , Huw Campbell , Kaixi Ruan , and Khanh Nguyen , as well as to the Torch and PyTorch dev teams.

hasktorch's People

Contributors

alejandrocatalina avatar austinvhuang avatar dataopt avatar mitchellwrosen avatar stites avatar tstat avatar

Watchers

 avatar  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.