Documentation
¶
Index ¶
- func ConvertToF32(data []byte, dtype uint32, nelements uint64) []float32
- func New(modelPath string, params ml.BackendParams) (ml.Backend, error)
- func QuantizationVersion() uint32
- func Quantize(newType fsggml.TensorType, f32s []float32, shape []uint64) []byte
- func Threads(n int) int
- type Backend
- func (b *Backend) BackendMemory() ml.BackendMemory
- func (b *Backend) CacheConfig() ml.CacheConfig
- func (b *Backend) Close()
- func (b *Backend) Config() fs.Config
- func (b *Backend) Get(name string) ml.Tensor
- func (b *Backend) Load(ctx context.Context, progress func(float32)) error
- func (b *Backend) NewContext() ml.Context
- func (b *Backend) NewContextSize(n int) ml.Context
- type Context
- func (c Context) Arange(start, stop, step float32, dtype ml.DType) ml.Tensor
- func (c *Context) Close()
- func (c *Context) Compute(tensors ...ml.Tensor)
- func (c *Context) ComputeWithNotify(cb func(), tensors ...ml.Tensor)
- func (c *Context) Empty(dtype ml.DType, shape ...int) ml.Tensor
- func (c *Context) Forward(tensors ...ml.Tensor) ml.Context
- func (c Context) FromBytes(dtype ml.DType, s []uint8, shape ...int) ml.Tensor
- func (c *Context) FromFloatSlice(s []float32, shape ...int) ml.Tensor
- func (c *Context) FromIntSlice(s []int32, shape ...int) ml.Tensor
- func (c *Context) Input() ml.Context
- func (c *Context) Layer(i int) ml.Context
- func (c *Context) MaxGraphNodes() int
- func (c *Context) Reserve()
- func (c *Context) Zeros(dtype ml.DType, shape ...int) ml.Tensor
- type Tensor
- func (t *Tensor) Add(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) AddID(ctx ml.Context, t2, ids ml.Tensor) ml.Tensor
- func (t *Tensor) Argsort(ctx ml.Context) ml.Tensor
- func (t *Tensor) AvgPool2D(ctx ml.Context, k, s int, p float32) ml.Tensor
- func (t *Tensor) Bytes() (data []byte)
- func (t *Tensor) Cast(ctx ml.Context, dtype ml.DType) ml.Tensor
- func (t *Tensor) Clamp(ctx ml.Context, min, max float32) ml.Tensor
- func (t *Tensor) Concat(ctx ml.Context, t2 ml.Tensor, dim int) ml.Tensor
- func (t *Tensor) Contiguous(ctx ml.Context, shape ...int) ml.Tensor
- func (t *Tensor) Conv2D(ctx ml.Context, t2 ml.Tensor, s0, s1, p0, p1, d0, d1 int) ml.Tensor
- func (t *Tensor) Copy(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) Cos(ctx ml.Context) ml.Tensor
- func (t *Tensor) DType() ml.DType
- func (t *Tensor) Dim(n int) int
- func (t *Tensor) Div(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) Duplicate(ctx ml.Context) ml.Tensor
- func (t *Tensor) Floats() (data []float32)
- func (t *Tensor) GELU(ctx ml.Context, t2 ...ml.Tensor) ml.Tensor
- func (t *Tensor) IM2Col(ctx ml.Context, t2 ml.Tensor, s0, s1, p0, p1, d0, d1 int) ml.Tensor
- func (t *Tensor) L2Norm(ctx ml.Context, eps float32) ml.Tensor
- func (t *Tensor) LayerNorm(ctx ml.Context, w, b ml.Tensor, eps float32) ml.Tensor
- func (t *Tensor) LogValue() slog.Value
- func (t *Tensor) Mean(ctx ml.Context) ml.Tensor
- func (t *Tensor) Mul(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) Mulmat(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) MulmatFullPrec(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) MulmatID(ctx ml.Context, t2, ids ml.Tensor) ml.Tensor
- func (t *Tensor) Neg(ctx ml.Context) ml.Tensor
- func (t *Tensor) Pad(ctx ml.Context, shape ...int) ml.Tensor
- func (t *Tensor) Permute(ctx ml.Context, shape ...int) ml.Tensor
- func (t *Tensor) RELU(ctx ml.Context, t2 ...ml.Tensor) ml.Tensor
- func (t *Tensor) RMSNorm(ctx ml.Context, w ml.Tensor, eps float32) ml.Tensor
- func (t *Tensor) Repeat(ctx ml.Context, dim, n int) ml.Tensor
- func (t *Tensor) Reshape(ctx ml.Context, shape ...int) ml.Tensor
- func (t *Tensor) RoPE(ctx ml.Context, positions ml.Tensor, ropeDim int, ropeBase, ropeScale float32, ...) ml.Tensor
- func (t *Tensor) Rows(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) SILU(ctx ml.Context, t2 ...ml.Tensor) ml.Tensor
- func (t *Tensor) SILUAlphaLimit(ctx ml.Context, up ml.Tensor, alpha, limit float32) ml.Tensor
- func (t *Tensor) Scale(ctx ml.Context, s float64) ml.Tensor
- func (t *Tensor) ScaledDotProductAttention(ctx ml.Context, key, value, mask, sinks ml.Tensor, scale float64) ml.Tensor
- func (t *Tensor) Set(ctx ml.Context, t2 ml.Tensor, offset int, strides ...int) ml.Tensor
- func (t *Tensor) SetValueFromIntSlice(s []int32)
- func (t *Tensor) Shape() []int
- func (t *Tensor) Sigmoid(ctx ml.Context) ml.Tensor
- func (t *Tensor) Sin(ctx ml.Context) ml.Tensor
- func (t *Tensor) Softmax(ctx ml.Context) ml.Tensor
- func (t *Tensor) Sqr(ctx ml.Context) ml.Tensor
- func (t *Tensor) Sqrt(ctx ml.Context) ml.Tensor
- func (t *Tensor) Stack(ctx ml.Context, dim int, s ...ml.Tensor) ml.Tensor
- func (t *Tensor) Stddev(ctx ml.Context) ml.Tensor
- func (t *Tensor) Stride(n int) int
- func (t *Tensor) Sub(ctx ml.Context, t2 ml.Tensor) ml.Tensor
- func (t *Tensor) SumRows(ctx ml.Context) ml.Tensor
- func (t *Tensor) Tanh(ctx ml.Context) ml.Tensor
- func (t *Tensor) TopK(ctx ml.Context, k int) ml.Tensor
- func (t *Tensor) Variance(ctx ml.Context) ml.Tensor
- func (t *Tensor) View(ctx ml.Context, offset int, shape ...int) ml.Tensor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToF32 ¶
ConvertToF32 converts (dequantizes) the raw data to F32 so we can then quantize it
func QuantizationVersion ¶
func QuantizationVersion() uint32
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func (*Backend) BackendMemory ¶
func (b *Backend) BackendMemory() ml.BackendMemory
func (*Backend) CacheConfig ¶
func (b *Backend) CacheConfig() ml.CacheConfig
func (*Backend) NewContext ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) ComputeWithNotify ¶
func (*Context) FromFloatSlice ¶
func (*Context) MaxGraphNodes ¶
type Tensor ¶
type Tensor struct {
// contains filtered or unexported fields
}
func (*Tensor) MulmatFullPrec ¶
func (*Tensor) SILUAlphaLimit ¶
func (*Tensor) ScaledDotProductAttention ¶
func (*Tensor) SetValueFromIntSlice ¶
Click to show internal directories.
Click to hide internal directories.