Code Monkey home page Code Monkey logo

htproject's Introduction

creating a hasktorch project

Download the libtorch dependency in ./libtorch by downloading an archive here e.g. cpu-libtorch-cxx11-abi-shared-with-deps-latest.zip

$ curl -L https://github.com/hasktorch/libtorch-binary-for-ci/releases/download/1.8.0/cpu-libtorch-cxx11-abi-shared-with-deps-latest.zip >> libtorch.zip

$ unzip libtorch.zip

Reference hasktorch git commit in stack.yaml extra-deps:

# ./stack.yaml

resolver: lts-17.4

packages:
- . 

extra-deps:
  - git: https://github.com/hasktorch/hasktorch.git
    commit: 4e846fdcd89df5c7c6991cb9d6142007a6bb0a58
    subdirs:
      - hasktorch
      - libtorch-ffi
      - libtorch-ffi-helper

extra-include-dirs:
  - libtorch/include/torch/csrc/api/include
  - libtorch/include

extra-lib-dirs:
  - ./libtorch/lib

Reference hasktorch in package.yaml too:

# ./package.yaml 
# ...
dependencies:
- base >= 4.7 && < 5
- hasktorch

You should then be able to load the library:

$ stack build
$ stack ghci
ghci> import Torch
ghci> :t asTensor [1, 2, 3]

documentation

Follow on to the tutorial here.

htproject's People

Contributors

opeltre avatar

Watchers

James Cloos 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.