flint

package
v0.0.0-...-7215382 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package flint serves as a wrapper around the specific flint library. It abstracts away all technicalities like memory management and error handling.

This package should be used to handle all flint operations instead of relying on the underlying Library alone and risking memory issues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Axes

type Axes = wrapper.Axes

Copy the most important types

type DataType

type DataType = wrapper.DataType

Copy the most important types

type Double

type Double = wrapper.Double

Copy the most important types

type Float

type Float = wrapper.Float

Copy the most important types

type Int

type Int = wrapper.Int

Copy the most important types

type Long

type Long = wrapper.Long

Copy the most important types

type Numeric

type Numeric = wrapper.Numeric

Copy the most important types

type Parameter

type Parameter Tensor

Parameter is a container object for a trainable Tensor

func NewParameter

func NewParameter(tensor Tensor) Parameter

NewParameter initializes the node as a trainable Tensor

func (Parameter) Close

func (p Parameter) Close()

func (Parameter) Node

func (p Parameter) Node() wrapper.GraphNode

type Shape

type Shape = wrapper.Shape // this way we keep the functions etc.

Copy the most important types

type Stride

type Stride = wrapper.Stride

Copy the most important types

type Tensor

type Tensor struct {
	// contains filtered or unexported fields
}

Tensor essentially acts as a memory-safe wrapper for wrapper.GraphNode. Since go does not have a destructor for GraphNode any references to nodes in C memory cannot be cleaned up. By having a [Close] method, the memory cleanup can be deferred.

func Abs

func Abs(x Tensor) Tensor

func Acos

func Acos(x Tensor) Tensor

func Add

func Add(x Tensor, y Tensor) Tensor

func Arrange

func Arrange(shape Shape, axis int) Tensor

func Asin

func Asin(x Tensor) Tensor

func Atan

func Atan(x Tensor) Tensor

func Concat

func Concat(x Tensor, y Tensor, axis uint) Tensor

func Constant

func Constant[T Numeric](val T, shape Shape) Tensor

func Convert

func Convert(x Tensor, dtype wrapper.DataType) Tensor

func Convolve

func Convolve(x Tensor, kernel Tensor, stride Stride) Tensor

func Cos

func Cos(x Tensor) Tensor

func CreateFromSlice

func CreateFromSlice(data any, dataType DataType) Tensor

func CreateFromSliceAndShape

func CreateFromSliceAndShape(data any, shape Shape, dataType DataType) Tensor

func Div

func Div(x Tensor, y Tensor) Tensor

func Dropout

func Dropout(x Tensor, rate wrapper.Double) Tensor

func Equal

func Equal(x Tensor, y Tensor) Tensor

func Even

func Even(x Tensor) Tensor

func Exp

func Exp(x Tensor) Tensor

func Expand

func Expand(x Tensor, axis uint, size uint) Tensor

func Extend

func Extend(x Tensor, shape Shape, insertAt Axes) Tensor

func ExtendWithStride

func ExtendWithStride(x Tensor, shape Shape, insertAt Axes, stride Stride) Tensor

func Flatten

func Flatten(x Tensor) Tensor

func FlattenDim

func FlattenDim(x Tensor, dim int) Tensor

func FromNode

func FromNode(node wrapper.GraphNode) Tensor

func FromNodeWithErr

func FromNodeWithErr(node wrapper.GraphNode, err error) Tensor

func Greater

func Greater(x Tensor, y Tensor) Tensor

func Identity

func Identity(size uint) Tensor

Identity creates an identity matrix. The datatype will be [INT32]

func Index

func Index(x Tensor, indices Tensor) Tensor

func IndexSet

func IndexSet(x Tensor, indices Tensor, y Tensor) Tensor

func Less

func Less(x Tensor, y Tensor) Tensor

func Ln

func Ln(x Tensor) Tensor

func Log10

func Log10(x Tensor) Tensor

func Log2

func Log2(x Tensor) Tensor

func Matmul

func Matmul(x Tensor, y Tensor) Tensor

func Maximum

func Maximum(x Tensor, y Tensor) Tensor

func Minimum

func Minimum(x Tensor, y Tensor) Tensor

func Mul

func Mul(x Tensor, y Tensor) Tensor

func Neg

func Neg(x Tensor) Tensor

func Permute

func Permute(x Tensor, axes uint) Tensor

func PoolingMax

func PoolingMax(x Tensor, size Shape, stride Stride) Tensor

func PoolingSum

func PoolingSum(x Tensor, size Shape, stride Stride) Tensor

func Pow

func Pow(x Tensor, y Tensor) Tensor

func Random

func Random(shape Shape) Tensor

func ReduceMax

func ReduceMax(x Tensor, dim int) Tensor

func ReduceMin

func ReduceMin(x Tensor, dim int) Tensor

func ReduceMul

func ReduceMul(x Tensor, dim int) Tensor

func ReduceSum

func ReduceSum(x Tensor, dim int) Tensor

func Repeat

func Repeat(x Tensor, repetitions Axes) Tensor

func Reshape

func Reshape(x Tensor, shape Shape) Tensor

func Scalar

func Scalar[T Numeric](val T) Tensor

func Sign

func Sign(x Tensor) Tensor

func Sin

func Sin(x Tensor) Tensor

func Slice

func Slice(x Tensor, start Axes, end Axes) Tensor

func SliceWithStride

func SliceWithStride(x Tensor, start Axes, end Axes, stride Stride) Tensor

func SlidingWindow

func SlidingWindow(x Tensor, window Shape, stride Stride) Tensor

func Sqrt

func Sqrt(x Tensor) Tensor

func Sub

func Sub(x Tensor, y Tensor) Tensor

func Tan

func Tan(x Tensor) Tensor

func Transpose

func Transpose(x Tensor, axes Axes) Tensor

func TransposeFull

func TransposeFull(x Tensor) Tensor

TransposeFull acts like a traditional transpose where the order of all axis are reversed

func UnslideWindow

func UnslideWindow(x Tensor, window Shape, stride Stride) Tensor

func (Tensor) Abs

func (x Tensor) Abs() Tensor

func (*Tensor) Abs_

func (x *Tensor) Abs_()

func (Tensor) Acos

func (x Tensor) Acos() Tensor

func (*Tensor) Acos_

func (x *Tensor) Acos_()

func (Tensor) Add

func (x Tensor) Add(y Tensor) Tensor

func (*Tensor) Add_

func (x *Tensor) Add_(y Tensor)

func (Tensor) Asin

func (x Tensor) Asin() Tensor

func (*Tensor) Asin_

func (x *Tensor) Asin_()

func (Tensor) Atan

func (x Tensor) Atan() Tensor

func (*Tensor) Atan_

func (x *Tensor) Atan_()

func (Tensor) Close

func (x Tensor) Close()

Close resets the ref counter to 0. This fixes memory management issues, as the node can be cleared on subsequent calls to wrapper.OptimizeMemory

func (Tensor) Concat

func (x Tensor) Concat(y Tensor, axis uint) Tensor

func (*Tensor) Concat_

func (x *Tensor) Concat_(y Tensor, axis uint)

func (Tensor) Convert

func (x Tensor) Convert(dtype wrapper.DataType) Tensor

func (*Tensor) Convert_

func (x *Tensor) Convert_(dtype wrapper.DataType)

func (Tensor) Convolve

func (x Tensor) Convolve(kernel Tensor, stride Stride) Tensor

func (*Tensor) Convolve_

func (x *Tensor) Convolve_(kernel Tensor, stride Stride)

func (Tensor) Cos

func (x Tensor) Cos() Tensor

func (*Tensor) Cos_

func (x *Tensor) Cos_()

func (Tensor) DataType

func (x Tensor) DataType() DataType

func (Tensor) Div

func (x Tensor) Div(y Tensor) Tensor

func (*Tensor) Div_

func (x *Tensor) Div_(y Tensor)

func (Tensor) Dropout

func (x Tensor) Dropout(rate wrapper.Double) Tensor

func (*Tensor) Dropout_

func (x *Tensor) Dropout_(rate wrapper.Double)

func (Tensor) Equal

func (x Tensor) Equal(y Tensor) Tensor

func (*Tensor) Equal_

func (x *Tensor) Equal_(y Tensor)

func (Tensor) Even

func (x Tensor) Even() Tensor

func (*Tensor) Even_

func (x *Tensor) Even_()

func (Tensor) Exp

func (x Tensor) Exp() Tensor

func (*Tensor) Exp_

func (x *Tensor) Exp_()

func (Tensor) Expand

func (x Tensor) Expand(axis uint, size uint) Tensor

func (*Tensor) Expand_

func (x *Tensor) Expand_(axis uint, size uint)

func (Tensor) Extend

func (x Tensor) Extend(shape Shape, insertAt Axes) Tensor

func (Tensor) ExtendWithStride

func (x Tensor) ExtendWithStride(shape Shape, insertAt Axes, stride Stride) Tensor

func (*Tensor) ExtendWithStride_

func (x *Tensor) ExtendWithStride_(shape Shape, insertAt Axes, stride Stride)

func (*Tensor) Extend_

func (x *Tensor) Extend_(shape Shape, insertAt Axes)

func (Tensor) Flatten

func (x Tensor) Flatten() Tensor

func (Tensor) FlattenDim

func (x Tensor) FlattenDim(dim int) Tensor

func (*Tensor) FlattenDim_

func (x *Tensor) FlattenDim_(dim int)

func (*Tensor) Flatten_

func (x *Tensor) Flatten_()

func (Tensor) Greater

func (x Tensor) Greater(y Tensor) Tensor

func (*Tensor) Greater_

func (x *Tensor) Greater_(y Tensor)

func (Tensor) Index

func (x Tensor) Index(indices Tensor) Tensor

func (Tensor) IndexSet

func (x Tensor) IndexSet(indices Tensor, y Tensor) Tensor

func (*Tensor) IndexSet_

func (x *Tensor) IndexSet_(indices Tensor, y Tensor)

func (*Tensor) Index_

func (x *Tensor) Index_(indices Tensor)

func (Tensor) Less

func (x Tensor) Less(y Tensor) Tensor

func (*Tensor) Less_

func (x *Tensor) Less_(y Tensor)

func (Tensor) Ln

func (x Tensor) Ln() Tensor

func (*Tensor) Ln_

func (x *Tensor) Ln_()

func (Tensor) Log10

func (x Tensor) Log10() Tensor

func (*Tensor) Log10_

func (x *Tensor) Log10_()

func (Tensor) Log2

func (x Tensor) Log2() Tensor

func (*Tensor) Log2_

func (x *Tensor) Log2_()

func (Tensor) Matmul

func (x Tensor) Matmul(y Tensor) Tensor

func (*Tensor) Matmul_

func (x *Tensor) Matmul_(y Tensor)

func (Tensor) Maximum

func (x Tensor) Maximum(y Tensor) Tensor

func (*Tensor) Maximum_

func (x *Tensor) Maximum_(y Tensor)

func (Tensor) Minimum

func (x Tensor) Minimum(y Tensor) Tensor

func (*Tensor) Minimum_

func (x *Tensor) Minimum_(y Tensor)

func (Tensor) Mul

func (x Tensor) Mul(y Tensor) Tensor

func (*Tensor) Mul_

func (x *Tensor) Mul_(y Tensor)

func (Tensor) Neg

func (x Tensor) Neg() Tensor

func (*Tensor) Neg_

func (x *Tensor) Neg_()

func (Tensor) Node

func (x Tensor) Node() wrapper.GraphNode

func (Tensor) Permute

func (x Tensor) Permute(axes uint) Tensor

func (*Tensor) Permute_

func (x *Tensor) Permute_(axes uint)

func (Tensor) PoolingMax

func (x Tensor) PoolingMax(size Shape, stride Stride) Tensor

func (*Tensor) PoolingMax_

func (x *Tensor) PoolingMax_(size Shape, stride Stride)

func (Tensor) PoolingSum

func (x Tensor) PoolingSum(size Shape, stride Stride) Tensor

func (*Tensor) PoolingSum_

func (x *Tensor) PoolingSum_(size Shape, stride Stride)

func (Tensor) Pow

func (x Tensor) Pow(y Tensor) Tensor

func (*Tensor) Pow_

func (x *Tensor) Pow_(y Tensor)

func (Tensor) ReduceMax

func (x Tensor) ReduceMax(dim int) Tensor

func (*Tensor) ReduceMax_

func (x *Tensor) ReduceMax_(dim int)

func (Tensor) ReduceMin

func (x Tensor) ReduceMin(dim int) Tensor

func (*Tensor) ReduceMin_

func (x *Tensor) ReduceMin_(dim int)

func (Tensor) ReduceMul

func (x Tensor) ReduceMul(dim int) Tensor

func (*Tensor) ReduceMul_

func (x *Tensor) ReduceMul_(dim int)

func (Tensor) ReduceSum

func (x Tensor) ReduceSum(dim int) Tensor

func (*Tensor) ReduceSum_

func (x *Tensor) ReduceSum_(dim int)

func (Tensor) Repeat

func (x Tensor) Repeat(repetitions Axes) Tensor

func (*Tensor) Repeat_

func (x *Tensor) Repeat_(repetitions Axes)

func (Tensor) Reshape

func (x Tensor) Reshape(shape Shape) Tensor

func (*Tensor) Reshape_

func (x *Tensor) Reshape_(shape Shape)

func (Tensor) Shape

func (x Tensor) Shape() Shape

func (Tensor) Sign

func (x Tensor) Sign() Tensor

func (*Tensor) Sign_

func (x *Tensor) Sign_()

func (Tensor) Sin

func (x Tensor) Sin() Tensor

func (*Tensor) Sin_

func (x *Tensor) Sin_()

func (Tensor) Slice

func (x Tensor) Slice(start Axes, end Axes) Tensor

func (Tensor) SliceWithStride

func (x Tensor) SliceWithStride(start Axes, end Axes, stride Stride) Tensor

func (*Tensor) SliceWithStride_

func (x *Tensor) SliceWithStride_(start Axes, end Axes, stride Stride)

func (*Tensor) Slice_

func (x *Tensor) Slice_(start Axes, end Axes)

func (Tensor) SlidingWindow

func (x Tensor) SlidingWindow(window Shape, stride Stride) Tensor

func (*Tensor) SlidingWindow_

func (x *Tensor) SlidingWindow_(window Shape, stride Stride)

func (Tensor) Sqrt

func (x Tensor) Sqrt() Tensor

func (*Tensor) Sqrt_

func (x *Tensor) Sqrt_()

func (Tensor) String

func (x Tensor) String() string

String prints the contents of the flint.

func (Tensor) Sub

func (x Tensor) Sub(y Tensor) Tensor

func (*Tensor) Sub_

func (x *Tensor) Sub_(y Tensor)

func (Tensor) Tan

func (x Tensor) Tan() Tensor

func (*Tensor) Tan_

func (x *Tensor) Tan_()

func (Tensor) Transpose

func (x Tensor) Transpose(axes Axes) Tensor

func (*Tensor) Transpose_

func (x *Tensor) Transpose_(axes Axes)

func (Tensor) UnslideWindow

func (x Tensor) UnslideWindow(window Shape, stride Stride) Tensor

func (*Tensor) UnslideWindow_

func (x *Tensor) UnslideWindow_(window Shape, stride Stride)

func (Tensor) ValueDouble

func (x Tensor) ValueDouble() ([]Double, error)

func (Tensor) ValueFloat

func (x Tensor) ValueFloat() ([]Float, error)

func (Tensor) ValueInt

func (x Tensor) ValueInt() ([]Int, error)

func (Tensor) ValueLong

func (x Tensor) ValueLong() ([]Long, error)

Jump to

Keyboard shortcuts

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