gmat

package module
v0.0.0-...-2829ab9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2019 License: Apache-2.0 Imports: 2 Imported by: 4

README

gmat

golang matrix library

Sample

package main

import (
	"github.com/kuroko1t/gmat"
	"fmt"
)


func main() {
    xdot := [][]float64{
        {2, 3, 6},
        {1, 4, 4},
        {2, 1, 5},
        {3, 4, 3},
    }
    ydot := [][]float64{
        {3, 1, 2, 2, 3},
        {2, 4, 2, 4, 6},
        {3, 4, 6, 3, 8},
    }
    xtensor := gmat.Make2DInitArray(xdot)
    ytensor := gmat.Make2DInitArray(ydot)
    ztensor := gmat.Dot(xtensor, ytensor)
    fmt.Println(ztensor.CPU)
}

Document

https://godoc.org/github.com/kuroko1t/gmat

API

  • Make(shape []int) Tensor
  • Make2DInitArray(x [][]float64) Tensor
  • MakeInit(n int, m int, value float64) Tensor
  • Add(x, y Tensor) Tensor
  • AddE(x Tensor, y float64) Tensor
  • Sub(x, y Tensor) Tensor
  • SubE(x Tensor, y float64) Tensor
  • MulE(x Tensor, y float64) Tensor
  • Mul(x, y Tensor) Tensor
  • Div(x, y Tensor) Tensor
  • T(x Tensor) Tensor
  • Apply(x Tensor, fn func(float64) float64) Tensor
  • Dot(x, y Tensor) Tensor
  • SumRow(x Tensor) Tensor
  • SumCol(x Tensor) Tensor
  • Cast(x Tensor, castSize int) Tensor
  • MaxCol(x Tensor) Tensor
  • ArgMaxCol(x Tensor) [][]int
  • RandomNorm2D(r int, c int, init float64) Tensor
  • HeNorm2D(r int, c int) Tensor
  • Conv1D(x, filter Tensor, stride int) Tensor

License

gmat is licensed under the Apache License, Version2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgMaxCol

func ArgMaxCol(x Tensor) [][]int

func Pad4D

func Pad4D(input [][][][]float64, pad [][]int) [][][][]float64

func Reshape2D1D

func Reshape2D1D(x Tensor) []float64

func Reshape2D6D

func Reshape2D6D(input [][]float64, reN int, reC int, reH int, reW int, reX int, reY int) [][][][][][]float64

func Reshape4D6D

func Reshape4D6D(input [][][][]float64, reN int, reC int, reH int, reW int, reX int, reY int) [][][][][][]float64

func Shape2D

func Shape2D(x Tensor) (n int, c int)

func Shape4D

func Shape4D(input Tensor) (n int, c int, h int, w int)

func Shape6D

func Shape6D(input [][][][][][]float64) (n int, c int, h int, w int, x int, y int)

Types

type Tensor

type Tensor cpu.Tensor

func Add

func Add(x, y Tensor) Tensor

func AddE

func AddE(x Tensor, y float64) Tensor

func Apply

func Apply(x Tensor, fn func(float64) float64) Tensor

func Cast

func Cast(x Tensor, castSize int) Tensor

func Conv1D

func Conv1D(x, filter Tensor, stride int) Tensor

func Div

func Div(x, y Tensor) Tensor

func Dot

func Dot(x, y Tensor) Tensor

func HeNorm2D

func HeNorm2D(r int, c int) Tensor

func Make

func Make(shape []int) Tensor

func Make2DInitArray

func Make2DInitArray(x [][]float64) Tensor

func MakeInit

func MakeInit(n int, m int, value float64) Tensor

func MaxCol

func MaxCol(x Tensor) Tensor

func Mul

func Mul(x, y Tensor) Tensor

func MulE

func MulE(x Tensor, y float64) Tensor

func RandomNorm2D

func RandomNorm2D(r int, c int, init float64) Tensor

func Reshape1D2D

func Reshape1D2D(x []float64, n, c int) Tensor

func Reshape4D

func Reshape4D(input Tensor, reX int, reY int) Tensor

func Sub

func Sub(x, y Tensor) Tensor

func SubE

func SubE(x Tensor, y float64) Tensor

func SumCol

func SumCol(x Tensor) Tensor

func SumRow

func SumRow(x Tensor) Tensor

func T

func T(x Tensor) Tensor

func Trans2D

func Trans2D(input Tensor, n int, c int) Tensor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL