mlx

package
v0.17.17 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

This is the non-Apple/non-cgo stub for the mlx package. It mirrors the public API declared in mlx_cgo.go and mlx_ops.go but every function returns an error, so callers that branch on Available() (and stub-out calls when it is false) compile and run on every platform. The embedding provider uses Available() to pick the MLX path on Apple Silicon and fall back to the ONNX backend everywhere else.

The file-level comment above the build tag keeps the package doc (which lives in mlx_cgo.go) from being orphaned on stub-only builds: cgo and stub files are mutually exclusive, so the package doc only renders when the cgo file is present. This stub therefore intentionally has no package doc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available reports whether an Apple Silicon GPU is present and usable. Always false in this stub (non-cgo or non-Apple build).

Types

type Array

type Array struct{}

Array is a non-functional placeholder on platforms without MLX.

func Abs

func Abs(a *Array, s *Stream) (*Array, error)

Abs returns errUnavailable on stub builds.

func Add

func Add(a, b *Array, s *Stream) (*Array, error)

Add returns errUnavailable on stub builds.

func Arange

func Arange(start, stop, step float64, dtype Dtype, s *Stream) (*Array, error)

Arange returns errUnavailable on stub builds.

func Cast

func Cast(a *Array, dtype Dtype, s *Stream) (*Array, error)

Cast returns errUnavailable on stub builds.

func Concatenate

func Concatenate(arrays []*Array, s *Stream) (*Array, error)

Concatenate returns errUnavailable on stub builds.

func ConcatenateAxis

func ConcatenateAxis(arrays []*Array, axis int, s *Stream) (*Array, error)

ConcatenateAxis returns errUnavailable on stub builds.

func Cos

func Cos(a *Array, s *Stream) (*Array, error)

Cos returns errUnavailable on stub builds.

func Divide

func Divide(a, b *Array, s *Stream) (*Array, error)

Divide returns errUnavailable on stub builds.

func Exp

func Exp(a *Array, s *Stream) (*Array, error)

Exp returns errUnavailable on stub builds.

func Gather

func Gather(a, indices *Array, axes, sliceSizes []int, s *Stream) (*Array, error)

Gather returns errUnavailable on stub builds.

func GatherAxis

func GatherAxis(a, indices *Array, axis int, sliceSizes []int, s *Stream) (*Array, error)

GatherAxis returns errUnavailable on stub builds.

func MatMul

func MatMul(a, b *Array, s *Stream) (*Array, error)

MatMul returns errUnavailable on stub builds.

func Max

func Max(a *Array, axes []int, keepdims bool, s *Stream) (*Array, error)

Max returns errUnavailable on stub builds.

func Maximum

func Maximum(a, b *Array, s *Stream) (*Array, error)

Maximum returns errUnavailable on stub builds.

func Mean

func Mean(a *Array, axes []int, keepdims bool, s *Stream) (*Array, error)

Mean returns errUnavailable on stub builds.

func Multiply

func Multiply(a, b *Array, s *Stream) (*Array, error)

Multiply returns errUnavailable on stub builds.

func NewArrayFromFloat32

func NewArrayFromFloat32(data []float32, shape []int) (*Array, error)

NewArrayFromFloat32 returns errUnavailable on stub builds.

func NewArrayFromInt32

func NewArrayFromInt32(data []int32, shape []int) (*Array, error)

NewArrayFromInt32 returns errUnavailable on stub builds.

func NewArrayFromInt64

func NewArrayFromInt64(data []int64, shape []int) (*Array, error)

NewArrayFromInt64 returns errUnavailable on stub builds.

func Pad

func Pad(a *Array, axes, low, high []int, padValue *Array, s *Stream) (*Array, error)

Pad returns errUnavailable on stub builds.

func Power

func Power(a *Array, exp float32, s *Stream) (*Array, error)

Power returns errUnavailable on stub builds.

func RepeatAxis

func RepeatAxis(a *Array, repeats, axis int, s *Stream) (*Array, error)

RepeatAxis returns errUnavailable on stub builds.

func Reshape

func Reshape(a *Array, shape []int, s *Stream) (*Array, error)

Reshape returns errUnavailable on stub builds.

func Sin

func Sin(a *Array, s *Stream) (*Array, error)

Sin returns errUnavailable on stub builds.

func Slice

func Slice(a *Array, start, stop, strides []int, s *Stream) (*Array, error)

Slice returns errUnavailable on stub builds.

func Softmax

func Softmax(a *Array, s *Stream) (*Array, error)

Softmax returns errUnavailable on stub builds.

func SoftmaxAxis

func SoftmaxAxis(a *Array, axis int, s *Stream) (*Array, error)

SoftmaxAxis returns errUnavailable on stub builds.

func Split

func Split(a *Array, indices []int, s *Stream) ([]*Array, error)

Split returns errUnavailable on stub builds.

func SplitAxis

func SplitAxis(a *Array, indices []int, axis int, s *Stream) ([]*Array, error)

SplitAxis returns errUnavailable on stub builds.

func Sqrt

func Sqrt(a *Array, s *Stream) (*Array, error)

Sqrt returns errUnavailable on stub builds.

func Square

func Square(a *Array, s *Stream) (*Array, error)

Square returns errUnavailable on stub builds.

func SqueezeAxis

func SqueezeAxis(a *Array, axis int, s *Stream) (*Array, error)

SqueezeAxis returns errUnavailable on stub builds.

func Subtract

func Subtract(a, b *Array, s *Stream) (*Array, error)

Subtract returns errUnavailable on stub builds.

func Sum

func Sum(a *Array, axes []int, keepdims bool, s *Stream) (*Array, error)

Sum returns errUnavailable on stub builds.

func Tanh

func Tanh(a *Array, s *Stream) (*Array, error)

Tanh returns errUnavailable on stub builds.

func Transpose

func Transpose(a *Array, s *Stream) (*Array, error)

Transpose returns errUnavailable on stub builds.

func TransposeAxes

func TransposeAxes(a *Array, axes []int, s *Stream) (*Array, error)

TransposeAxes returns errUnavailable on stub builds.

func Tril

func Tril(a *Array, k int, s *Stream) (*Array, error)

Tril returns errUnavailable on stub builds.

func Where

func Where(condition, x, y *Array, s *Stream) (*Array, error)

Where returns errUnavailable on stub builds.

func (*Array) Dtype

func (a *Array) Dtype() Dtype

Dtype returns the zero value on stub builds.

func (*Array) Eval

func (a *Array) Eval() error

Eval always returns errUnavailable on stub builds.

func (*Array) Float32Data

func (a *Array) Float32Data() ([]float32, error)

Float32Data always returns errUnavailable on stub builds.

func (*Array) Free

func (a *Array) Free()

Free is a no-op on stub builds.

func (*Array) Int64Data

func (a *Array) Int64Data() ([]int64, error)

Int64Data always returns errUnavailable on stub builds.

func (*Array) Ndim

func (a *Array) Ndim() int

Ndim returns 0 on stub builds.

func (*Array) Shape

func (a *Array) Shape() []int

Shape returns nil on stub builds.

func (*Array) Size

func (a *Array) Size() int

Size returns 0 on stub builds.

type Dtype

type Dtype int

Dtype mirrors the cgo Dtype so constants below have a type. The zero value is meaningless; the constants carry the same names as the cgo build.

const (
	Bool  Dtype = iota
	UInt8       // explicit iota on subsequent lines for godoc alignment
	UInt16
	UInt32
	UInt64
	Int8
	Int16
	Int32
	Int64
	Float16
	Float32
	Float64
	BFloat16
	Complex64
)

Dtype constants mirror the cgo build. The numeric values need not match the mlx_dtype enum because these are never passed to C — they exist only so the stub compiles the same set of exported names.

type Stream

type Stream struct{}

Stream is a non-functional placeholder on platforms without MLX.

func DefaultGPUStream

func DefaultGPUStream() (*Stream, error)

DefaultGPUStream returns errUnavailable on stub builds.

func DefaultStream

func DefaultStream() (*Stream, error)

DefaultStream returns errUnavailable on stub builds.

func (*Stream) Free

func (s *Stream) Free()

Free is a no-op on stub builds.

func (*Stream) Synchronize

func (s *Stream) Synchronize() error

Synchronize is a no-op on stub builds.

Jump to

Keyboard shortcuts

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