Go to file
2020-06-23 13:37:26 +10:00
example fix(nn/sequential, linear): fixed memory held up due to undeleted middle tensors 2020-06-23 13:37:26 +10:00
gen WIP(nn/varstore): added varstore.go 2020-06-13 13:10:24 +10:00
libtch WIP(example/mnist): conv 2020-06-23 01:07:07 +10:00
nn fix(nn/sequential, linear): fixed memory held up due to undeleted middle tensors 2020-06-23 13:37:26 +10:00
tensor fix(nn/sequential, linear): fixed memory held up due to undeleted middle tensors 2020-06-23 13:37:26 +10:00
vision feat(tensor): add option to delete tensor after applying operator to free up C memory 2020-06-21 23:37:42 +10:00
.gitignore WIP(vision/image.go) 2020-06-14 22:46:36 +10:00
device.go feat(wrapper/tensor): LoadMultiWithDevice 2020-06-11 07:03:59 +10:00
dtype.go feat(vision/mnist): completed. WIP(example/mnist) 2020-06-15 13:19:42 +10:00
dune-project initial commit 2020-05-22 23:43:09 +10:00
go.mod removed unexpected dependecy packages 2020-06-18 12:15:06 +10:00
README.md fix(tensor/NoGrad): added a hacky way to get loss func updated 2020-06-17 16:24:27 +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

3. Notes on running examples

    # Either
    go clean -cache -testcache .
    go run [EXAMPLE FILES]

    # Or
    go build -a

    go run [EXAMPLE FILES]

Acknowledgement

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