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 ¶
- func Available() bool
- type Array
- func Abs(a *Array, s *Stream) (*Array, error)
- func Add(a, b *Array, s *Stream) (*Array, error)
- func Arange(start, stop, step float64, dtype Dtype, s *Stream) (*Array, error)
- func Cast(a *Array, dtype Dtype, s *Stream) (*Array, error)
- func Concatenate(arrays []*Array, s *Stream) (*Array, error)
- func ConcatenateAxis(arrays []*Array, axis int, s *Stream) (*Array, error)
- func Cos(a *Array, s *Stream) (*Array, error)
- func Divide(a, b *Array, s *Stream) (*Array, error)
- func Exp(a *Array, s *Stream) (*Array, error)
- func Gather(a, indices *Array, axes, sliceSizes []int, s *Stream) (*Array, error)
- func GatherAxis(a, indices *Array, axis int, sliceSizes []int, s *Stream) (*Array, error)
- func MatMul(a, b *Array, s *Stream) (*Array, error)
- func Max(a *Array, axes []int, keepdims bool, s *Stream) (*Array, error)
- func Maximum(a, b *Array, s *Stream) (*Array, error)
- func Mean(a *Array, axes []int, keepdims bool, s *Stream) (*Array, error)
- func Multiply(a, b *Array, s *Stream) (*Array, error)
- func NewArrayFromFloat32(data []float32, shape []int) (*Array, error)
- func NewArrayFromInt32(data []int32, shape []int) (*Array, error)
- func NewArrayFromInt64(data []int64, shape []int) (*Array, error)
- func Pad(a *Array, axes, low, high []int, padValue *Array, s *Stream) (*Array, error)
- func Power(a *Array, exp float32, s *Stream) (*Array, error)
- func RepeatAxis(a *Array, repeats, axis int, s *Stream) (*Array, error)
- func Reshape(a *Array, shape []int, s *Stream) (*Array, error)
- func Sin(a *Array, s *Stream) (*Array, error)
- func Slice(a *Array, start, stop, strides []int, s *Stream) (*Array, error)
- func Softmax(a *Array, s *Stream) (*Array, error)
- func SoftmaxAxis(a *Array, axis int, s *Stream) (*Array, error)
- func Split(a *Array, indices []int, s *Stream) ([]*Array, error)
- func SplitAxis(a *Array, indices []int, axis int, s *Stream) ([]*Array, error)
- func Sqrt(a *Array, s *Stream) (*Array, error)
- func Square(a *Array, s *Stream) (*Array, error)
- func SqueezeAxis(a *Array, axis int, s *Stream) (*Array, error)
- func Subtract(a, b *Array, s *Stream) (*Array, error)
- func Sum(a *Array, axes []int, keepdims bool, s *Stream) (*Array, error)
- func Tanh(a *Array, s *Stream) (*Array, error)
- func Transpose(a *Array, s *Stream) (*Array, error)
- func TransposeAxes(a *Array, axes []int, s *Stream) (*Array, error)
- func Tril(a *Array, k int, s *Stream) (*Array, error)
- func Where(condition, x, y *Array, s *Stream) (*Array, error)
- type Dtype
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Array ¶
type Array struct{}
Array is a non-functional placeholder on platforms without MLX.
func Concatenate ¶
Concatenate returns errUnavailable on stub builds.
func ConcatenateAxis ¶
ConcatenateAxis returns errUnavailable on stub builds.
func GatherAxis ¶
GatherAxis returns errUnavailable on stub builds.
func NewArrayFromFloat32 ¶
NewArrayFromFloat32 returns errUnavailable on stub builds.
func NewArrayFromInt32 ¶
NewArrayFromInt32 returns errUnavailable on stub builds.
func NewArrayFromInt64 ¶
NewArrayFromInt64 returns errUnavailable on stub builds.
func RepeatAxis ¶
RepeatAxis returns errUnavailable on stub builds.
func SoftmaxAxis ¶
SoftmaxAxis returns errUnavailable on stub builds.
func SqueezeAxis ¶
SqueezeAxis returns errUnavailable on stub builds.
func TransposeAxes ¶
TransposeAxes returns errUnavailable on stub builds.
func (*Array) Float32Data ¶
Float32Data always returns errUnavailable 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 ¶
DefaultGPUStream returns errUnavailable on stub builds.
func DefaultStream ¶
DefaultStream returns errUnavailable on stub builds.
func (*Stream) Synchronize ¶
Synchronize is a no-op on stub builds.