Giter Site home page Giter Site logo

ynsszr / diffsharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from diffsharp/diffsharp

0.0 1.0 0.0 166.62 MB

DiffSharp: Differentiable Functional Programming

Home Page: http://diffsharp.github.io

License: BSD 2-Clause "Simplified" License

F# 89.15% Dockerfile 0.01% Python 0.07% HTML 10.16% R 0.62%

diffsharp's Introduction


Documentation

Build Status Coverage Status

This is the development branch of DiffSharp 1.0.

NOTE: This branch is undergoing development. It has incomplete code, functionality, and design that are likely to change without notice.

Getting Started

DiffSharp is normally used from an F# Jupyter notebook. You can simply open examples directly in the browser, e.g.

To use locally in Visual Studio Code:

  • Install .NET Interactive Notebooks for VS Code

  • After opening an .ipynb execute Ctrl-Shift-P for the command palette and chose Reopen Editor With... then .NET Interactive Notebooks

  • To restart the kernel use restart from the command palette.

To use locally in Jupyter, first install Jupyter and then:

dotnet tool install -g microsoft.dotnet-interactive
dotnet interactive jupyter install

When using .NET Interactive it is best to completely turn off automatic HTML displays of outputs:

Formatter.SetPreferredMimeTypeFor(typeof<obj>, "text/plain")
Formatter.Register(fun x writer -> fprintfn writer "%120A" x )

You can also use DiffSharp from a script or an application. Here are some example scripts with appropriate package references:

Available packages and backends

Now reference an appropriate nuget package from https://nuget.org:

  • DiffSharp-lite - This is the reference backend.

  • DiffSharp-cpu - This includes the Torch backend using CPU only.

  • DiffSharp-cuda-linux - This includes the Torch CPU/CUDA 11.1 backend for Windows. Large download. Requires .NET 6 SDK, version 6.0.100-preview.5.21302.13 or greater.

  • DiffSharp-cuda-windows - This includes the Torch CPU/CUDA 11.1 backend for Windows. Large download.

For all but DiffSharp-lite add the following to your code:

dsharp.config(backend=Backend.Torch)

Using a pre-installed or self-built LibTorch 1.8.0

The Torch CPU and CUDA packages above are large. If you already have libtorch 1.8.0 available on your machine you can

  1. reference DiffSharp-lite

  2. set LD_LIBRARY_PATH to include a directory containing the relevant torch.so, torch_cpu.so and torch_cuda.so, or execute NativeLibrary.Load on torch.so.

  3. use dsharp.config(backend=Backend.Torch)

Developing DiffSharp Libraries

To develop libraries built on DiffSharp, do the following:

  1. reference DiffSharp.Core and DiffSharp.Data in your library code.

  2. reference DiffSharp.Backends.Reference in your correctness testing code.

  3. reference DiffSharp.Backends.Torch and libtorch-cpu in your CPU testing code.

  4. reference DiffSharp.Backends.Torch and libtorch-cuda-linux or libtorch-cuda-windows in your (optional) GPU testing code.

diffsharp's People

Contributors

gbaydin avatar dsyme avatar smoothdeveloper avatar visualmelon avatar kevmal avatar rwe avatar migueldeicaza avatar nhirschey avatar adelarsq avatar barak avatar cgravill avatar jonsequitur avatar soma-kurisu avatar mrakgr avatar pkese avatar

Watchers

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