Go to file
2020-06-12 13:38:26 +10:00
example WIP(tensor/index): added tensor/index.go 2020-06-12 13:38:26 +10:00
gen WIP(gen/gen.ml): c_generated 2020-06-05 00:04:12 +10:00
libtch feat(wrapper/image): added image.go 2020-06-11 17:23:38 +10:00
tensor WIP(tensor/index): added tensor/index.go 2020-06-12 13:38:26 +10:00
third_party/pytorch initial commit 2020-05-22 23:43:09 +10:00
wrapper feat(wrapper/image): added image.go 2020-06-11 17:23:38 +10:00
.gitignore WIP(gen/gen.ml): c_generated 2020-06-05 00:04:12 +10:00
device.go feat(wrapper/tensor): LoadMultiWithDevice 2020-06-11 07:03:59 +10:00
dtype.go feat(wrapper/tensor): CopyData function 2020-06-08 14:33:19 +10:00
dune-project initial commit 2020-05-22 23:43:09 +10:00
go.mod fix(mod): removed unexpected log package 2020-06-05 10:55:19 +10:00
README.md feat(README.md): updated 2020-06-05 10:53:07 +10:00

GoTch - Libtorch Go Binding

Overview

  • GoTch is a C++ Libtorch Go binding for developing and implementing deep learning projects in Go.

  • It is currently in heavy development mode and is considered unstable until version v1.0.0 is marked. Hence, one can use it with own risk.

  • One goal of this package is to create a thin wrapper of Libtorch to make use of its tensor APIs and CUDA support while implementing as much idiomatic Go as possible.

Dependencies

How to use

1. Libtorch installation

  • Make sure that a libtorch version 1.5.0 (either CPU or CUDA support) is installed in your system (default at "/opt/libtorch" in Linux/Mac OS).

2. Import GoTch package

    package main

    import(
        "fmt"
        
        "github.com/sugarme/gotch"
    )

    func main(){
        
        var d gotch.Cuda
        fmt.Printf("Cuda device count: %v\n", d.DeviceCount())
        fmt.Printf("Cuda is available: %v\n", d.IsAvailable())
        fmt.Printf("Cudnn is available: %v\n", d.CudnnIsAvailable())

    }
  • Other examples can be found at example folder

Acknowledgement

  • This projects has been inspired and used many concepts from tch-rs Libtorch Rust binding.