Skip to content
/ lnn Public

This is a generalized neural network package with clean and transparent API for the Go language.

License

Notifications You must be signed in to change notification settings

lovesaroha/lnn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lnn

This is a generalized neural network package with clean and transparent API for the Go language. Also available for javascript github/lovesaroha/lnn.js

Features

  • Lightweight and Fast.
  • Native Go implementation.
  • Tensor Operations.
  • Sequential Models.
  • Support loss functions like (Mean Square Error).
  • Opitmization algorithms like (Gradient Descent).

Requirements

  • Go 1.9 or higher. We aim to support the 3 latest versions of Go.

Installation

Simple install the package to your $GOPATH with the go tool from shell:

go get -u github.com/lovesaroha/lnn

Make sure Git is installed on your machine and in your system's PATH.

Tensor Usage

Create Tensor

  // Create tensor of given shape.
  tensor := lnn.Tensor([]int{3, 4})
  // Print values.
  tensor.Print()

image

Random Tensor

  // Create tensor of given shape and (minimum, maximum).
  tensor := lnn.Tensor([]int{3, 4} , -1 , 1)
  // Print values.
  tensor.Print()
  // Scalar tensor.
  stensor := lnn.Tensor([]int{} , -1 , 1)
  // Print values.
  stensor.Print()

image

Convert Slice Or Values Into Tensor

    // Slice of int to tensor and print values.
    lnn.ToTensor([]int{1, 2, 3}).Print()