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 ¶
- type Axes
- type DataType
- type Double
- type Float
- type Int
- type Long
- type Numeric
- type Parameter
- type Shape
- type Stride
- type Tensor
- func Abs(x Tensor) Tensor
- func Acos(x Tensor) Tensor
- func Add(x Tensor, y Tensor) Tensor
- func Arrange(shape Shape, axis int) Tensor
- func Asin(x Tensor) Tensor
- func Atan(x Tensor) Tensor
- func Concat(x Tensor, y Tensor, axis uint) Tensor
- func Constant[T Numeric](val T, shape Shape) Tensor
- func Convert(x Tensor, dtype wrapper.DataType) Tensor
- func Convolve(x Tensor, kernel Tensor, stride Stride) Tensor
- func Cos(x Tensor) Tensor
- func CreateFromSlice(data any, dataType DataType) Tensor
- func CreateFromSliceAndShape(data any, shape Shape, dataType DataType) Tensor
- func Div(x Tensor, y Tensor) Tensor
- func Dropout(x Tensor, rate wrapper.Double) Tensor
- func Equal(x Tensor, y Tensor) Tensor
- func Even(x Tensor) Tensor
- func Exp(x Tensor) Tensor
- func Expand(x Tensor, axis uint, size uint) Tensor
- func Extend(x Tensor, shape Shape, insertAt Axes) Tensor
- func ExtendWithStride(x Tensor, shape Shape, insertAt Axes, stride Stride) Tensor
- func Flatten(x Tensor) Tensor
- func FlattenDim(x Tensor, dim int) Tensor
- func FromNode(node wrapper.GraphNode) Tensor
- func FromNodeWithErr(node wrapper.GraphNode, err error) Tensor
- func Greater(x Tensor, y Tensor) Tensor
- func Identity(size uint) Tensor
- func Index(x Tensor, indices Tensor) Tensor
- func IndexSet(x Tensor, indices Tensor, y Tensor) Tensor
- func Less(x Tensor, y Tensor) Tensor
- func Ln(x Tensor) Tensor
- func Log10(x Tensor) Tensor
- func Log2(x Tensor) Tensor
- func Matmul(x Tensor, y Tensor) Tensor
- func Maximum(x Tensor, y Tensor) Tensor
- func Minimum(x Tensor, y Tensor) Tensor
- func Mul(x Tensor, y Tensor) Tensor
- func Neg(x Tensor) Tensor
- func Permute(x Tensor, axes uint) Tensor
- func PoolingMax(x Tensor, size Shape, stride Stride) Tensor
- func PoolingSum(x Tensor, size Shape, stride Stride) Tensor
- func Pow(x Tensor, y Tensor) Tensor
- func Random(shape Shape) Tensor
- func ReduceMax(x Tensor, dim int) Tensor
- func ReduceMin(x Tensor, dim int) Tensor
- func ReduceMul(x Tensor, dim int) Tensor
- func ReduceSum(x Tensor, dim int) Tensor
- func Repeat(x Tensor, repetitions Axes) Tensor
- func Reshape(x Tensor, shape Shape) Tensor
- func Scalar[T Numeric](val T) Tensor
- func Sign(x Tensor) Tensor
- func Sin(x Tensor) Tensor
- func Slice(x Tensor, start Axes, end Axes) Tensor
- func SliceWithStride(x Tensor, start Axes, end Axes, stride Stride) Tensor
- func SlidingWindow(x Tensor, window Shape, stride Stride) Tensor
- func Sqrt(x Tensor) Tensor
- func Sub(x Tensor, y Tensor) Tensor
- func Tan(x Tensor) Tensor
- func Transpose(x Tensor, axes Axes) Tensor
- func TransposeFull(x Tensor) Tensor
- func UnslideWindow(x Tensor, window Shape, stride Stride) Tensor
- func (x Tensor) Abs() Tensor
- func (x *Tensor) Abs_()
- func (x Tensor) Acos() Tensor
- func (x *Tensor) Acos_()
- func (x Tensor) Add(y Tensor) Tensor
- func (x *Tensor) Add_(y Tensor)
- func (x Tensor) Asin() Tensor
- func (x *Tensor) Asin_()
- func (x Tensor) Atan() Tensor
- func (x *Tensor) Atan_()
- func (x Tensor) Close()
- func (x Tensor) Concat(y Tensor, axis uint) Tensor
- func (x *Tensor) Concat_(y Tensor, axis uint)
- func (x Tensor) Convert(dtype wrapper.DataType) Tensor
- func (x *Tensor) Convert_(dtype wrapper.DataType)
- func (x Tensor) Convolve(kernel Tensor, stride Stride) Tensor
- func (x *Tensor) Convolve_(kernel Tensor, stride Stride)
- func (x Tensor) Cos() Tensor
- func (x *Tensor) Cos_()
- func (x Tensor) DataType() DataType
- func (x Tensor) Div(y Tensor) Tensor
- func (x *Tensor) Div_(y Tensor)
- func (x Tensor) Dropout(rate wrapper.Double) Tensor
- func (x *Tensor) Dropout_(rate wrapper.Double)
- func (x Tensor) Equal(y Tensor) Tensor
- func (x *Tensor) Equal_(y Tensor)
- func (x Tensor) Even() Tensor
- func (x *Tensor) Even_()
- func (x Tensor) Exp() Tensor
- func (x *Tensor) Exp_()
- func (x Tensor) Expand(axis uint, size uint) Tensor
- func (x *Tensor) Expand_(axis uint, size uint)
- func (x Tensor) Extend(shape Shape, insertAt Axes) Tensor
- func (x Tensor) ExtendWithStride(shape Shape, insertAt Axes, stride Stride) Tensor
- func (x *Tensor) ExtendWithStride_(shape Shape, insertAt Axes, stride Stride)
- func (x *Tensor) Extend_(shape Shape, insertAt Axes)
- func (x Tensor) Flatten() Tensor
- func (x Tensor) FlattenDim(dim int) Tensor
- func (x *Tensor) FlattenDim_(dim int)
- func (x *Tensor) Flatten_()
- func (x Tensor) Greater(y Tensor) Tensor
- func (x *Tensor) Greater_(y Tensor)
- func (x Tensor) Index(indices Tensor) Tensor
- func (x Tensor) IndexSet(indices Tensor, y Tensor) Tensor
- func (x *Tensor) IndexSet_(indices Tensor, y Tensor)
- func (x *Tensor) Index_(indices Tensor)
- func (x Tensor) Less(y Tensor) Tensor
- func (x *Tensor) Less_(y Tensor)
- func (x Tensor) Ln() Tensor
- func (x *Tensor) Ln_()
- func (x Tensor) Log10() Tensor
- func (x *Tensor) Log10_()
- func (x Tensor) Log2() Tensor
- func (x *Tensor) Log2_()
- func (x Tensor) Matmul(y Tensor) Tensor
- func (x *Tensor) Matmul_(y Tensor)
- func (x Tensor) Maximum(y Tensor) Tensor
- func (x *Tensor) Maximum_(y Tensor)
- func (x Tensor) Minimum(y Tensor) Tensor
- func (x *Tensor) Minimum_(y Tensor)
- func (x Tensor) Mul(y Tensor) Tensor
- func (x *Tensor) Mul_(y Tensor)
- func (x Tensor) Neg() Tensor
- func (x *Tensor) Neg_()
- func (x Tensor) Node() wrapper.GraphNode
- func (x Tensor) Permute(axes uint) Tensor
- func (x *Tensor) Permute_(axes uint)
- func (x Tensor) PoolingMax(size Shape, stride Stride) Tensor
- func (x *Tensor) PoolingMax_(size Shape, stride Stride)
- func (x Tensor) PoolingSum(size Shape, stride Stride) Tensor
- func (x *Tensor) PoolingSum_(size Shape, stride Stride)
- func (x Tensor) Pow(y Tensor) Tensor
- func (x *Tensor) Pow_(y Tensor)
- func (x Tensor) ReduceMax(dim int) Tensor
- func (x *Tensor) ReduceMax_(dim int)
- func (x Tensor) ReduceMin(dim int) Tensor
- func (x *Tensor) ReduceMin_(dim int)
- func (x Tensor) ReduceMul(dim int) Tensor
- func (x *Tensor) ReduceMul_(dim int)
- func (x Tensor) ReduceSum(dim int) Tensor
- func (x *Tensor) ReduceSum_(dim int)
- func (x Tensor) Repeat(repetitions Axes) Tensor
- func (x *Tensor) Repeat_(repetitions Axes)
- func (x Tensor) Reshape(shape Shape) Tensor
- func (x *Tensor) Reshape_(shape Shape)
- func (x Tensor) Shape() Shape
- func (x Tensor) Sign() Tensor
- func (x *Tensor) Sign_()
- func (x Tensor) Sin() Tensor
- func (x *Tensor) Sin_()
- func (x Tensor) Slice(start Axes, end Axes) Tensor
- func (x Tensor) SliceWithStride(start Axes, end Axes, stride Stride) Tensor
- func (x *Tensor) SliceWithStride_(start Axes, end Axes, stride Stride)
- func (x *Tensor) Slice_(start Axes, end Axes)
- func (x Tensor) SlidingWindow(window Shape, stride Stride) Tensor
- func (x *Tensor) SlidingWindow_(window Shape, stride Stride)
- func (x Tensor) Sqrt() Tensor
- func (x *Tensor) Sqrt_()
- func (x Tensor) String() string
- func (x Tensor) Sub(y Tensor) Tensor
- func (x *Tensor) Sub_(y Tensor)
- func (x Tensor) Tan() Tensor
- func (x *Tensor) Tan_()
- func (x Tensor) Transpose(axes Axes) Tensor
- func (x *Tensor) Transpose_(axes Axes)
- func (x Tensor) UnslideWindow(window Shape, stride Stride) Tensor
- func (x *Tensor) UnslideWindow_(window Shape, stride Stride)
- func (x Tensor) ValueDouble() ([]Double, error)
- func (x Tensor) ValueFloat() ([]Float, error)
- func (x Tensor) ValueInt() ([]Int, error)
- func (x Tensor) ValueLong() ([]Long, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parameter ¶
type Parameter Tensor
Parameter is a container object for a trainable Tensor
func NewParameter ¶
NewParameter initializes the node as a trainable Tensor
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 CreateFromSlice ¶
func CreateFromSliceAndShape ¶
func ExtendWithStride ¶
func FlattenDim ¶
func TransposeFull ¶
TransposeFull acts like a traditional transpose where the order of all axis are reversed
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