Documentation
¶
Overview ¶
Package graphbridge provides internal conversion helpers between the public core/graph wrapper types and the internal internal/graphimpl engine types, as well as internal graph operations used by higher-level GoMLX packages (such as ml/model, ml/nn, ml/layers, and core/autodiff).
Index ¶
- func AttachState(g *graph.Graph, key, value any)
- func BackendOutputs(n *graph.Node) []compute.Value
- func BatchNormForInference(operand, scale, offset, mean, variance *graph.Node, epsilon float32, axis int) *graph.Node
- func BatchNormForTraining(operand, scale, offset *graph.Node, epsilon float32, axis int) (normalized, batchMean, batchVariance *graph.Node)
- func BatchNormGradient(operand, scale, mean, variance, gradOutput *graph.Node, epsilon float32, ...) (gradOperand, gradScale, gradOffset *graph.Node)
- func ConstBuffer(g *graph.Graph, buf compute.Buffer, donate bool) *graph.Node
- func Exec(impl *graphimpl.ExecImpl) *graph.Exec
- func ExecImpl(e *graph.Exec) *graphimpl.ExecImpl
- func Executable(g *graph.Graph) compute.Executable
- func FinalizeConstantValue(val compute.Value)
- func Function(impl *graphimpl.FunctionImpl) *graph.Function
- func FunctionImpl(f *graph.Function) *graphimpl.FunctionImpl
- func FusedActivation(x *graph.Node, cfg compute.ActivationConfig) *graph.Node
- func FusedAttentionQKVProjection(x, wQKV, biasQ, biasK, biasV *graph.Node, queryDim, keyValueDim int) (query, key, value *graph.Node)
- func FusedDense(x, weight, bias *graph.Node, options compute.DenseConfig) *graph.Node
- func FusedLayerNorm(x, gamma, beta *graph.Node, config compute.FusedLayerNormConfig) *graph.Node
- func FusedOpCaller(fused, decomposed func() *graph.Node, useDecomposedAlternateVJP bool) (output *graph.Node, opFused bool)
- func FusedOpCallerMulti(fused, decomposed func() []*graph.Node, useDecomposedAlternateVJP bool) (outputs []*graph.Node, opFused bool)
- func FusedQuantizedDense(x, weight, bias *graph.Node, cfg graph.QuantizedDenseConfig) *graph.Node
- func FusedRoPE(x, cos, sin *graph.Node, config compute.FusedRoPEConfig) *graph.Node
- func FusedScaledDotProductAttention(query, key, value *graph.Node, axesLayout compute.AttentionAxesLayout, ...) (output *graph.Node, statesForVJP []*graph.Node)
- func Graph(impl *graphimpl.GraphImpl) *graph.Graph
- func GraphImpl(g *graph.Graph) *graphimpl.GraphImpl
- func Node(impl *graphimpl.NodeImpl) *graph.Node
- func NodeImpl(n *graph.Node) *graphimpl.NodeImpl
- func NodeImpls(nodes []*graph.Node) []*graphimpl.NodeImpl
- func Nodes(impls []*graphimpl.NodeImpl) []*graph.Node
- func QuantizationFromImpl(q *graphimpl.Quantization) *graph.Quantization
- func QuantizationToImpl(q *graph.Quantization) *graphimpl.Quantization
- func QuantizedDenseConfigFromImpl(cfg graphimpl.QuantizedDenseConfig) graph.QuantizedDenseConfig
- func QuantizedDenseConfigToImpl(cfg graph.QuantizedDenseConfig) graphimpl.QuantizedDenseConfig
- func QuantizedGather(x, indices *graph.Node, tq *graph.Quantization) *graph.Node
- func SharedConstant(g *graph.Graph, val compute.Value) *graph.Node
- func State(g *graph.Graph, key any) any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachState ¶
AttachState attaches auxiliary state keyed by key to the Graph.
func BackendOutputs ¶
BackendOutputs returns the underlying backend compute.Value slice for a Node.
func BatchNormForInference ¶
func BatchNormForInference(operand, scale, offset, mean, variance *graph.Node, epsilon float32, axis int) *graph.Node
BatchNormForInference wraps the backend BatchNormForInference operation.
func BatchNormForTraining ¶
func BatchNormForTraining(operand, scale, offset *graph.Node, epsilon float32, axis int) (normalized, batchMean, batchVariance *graph.Node)
BatchNormForTraining wraps the backend BatchNormForTraining operation.
func BatchNormGradient ¶
func BatchNormGradient(operand, scale, mean, variance, gradOutput *graph.Node, epsilon float32, axis int) (gradOperand, gradScale, gradOffset *graph.Node)
BatchNormGradient wraps the backend BatchNormGradient operation.
func ConstBuffer ¶
ConstBuffer creates a Constant node in g backed by buf.
func Executable ¶
func Executable(g *graph.Graph) compute.Executable
Executable returns the compiled compute.Executable of a compiled Graph.
func FinalizeConstantValue ¶
FinalizeConstantValue releases backend resources held by a shared constant compute.Value.
func Function ¶
func Function(impl *graphimpl.FunctionImpl) *graph.Function
Function converts an internal *graphimpl.FunctionImpl to its public *graph.Function wrapper.
func FunctionImpl ¶
func FunctionImpl(f *graph.Function) *graphimpl.FunctionImpl
FunctionImpl returns the underlying *graphimpl.FunctionImpl for a public *graph.Function.
func FusedActivation ¶
FusedActivation invokes BackendFusedActivation on the underlying GraphImpl.
func FusedAttentionQKVProjection ¶
func FusedAttentionQKVProjection(x, wQKV, biasQ, biasK, biasV *graph.Node, queryDim, keyValueDim int) (query, key, value *graph.Node)
FusedAttentionQKVProjection invokes BackendFusedAttentionQKVProjection on the underlying GraphImpl.
func FusedDense ¶
FusedDense invokes BackendFusedDense on the underlying GraphImpl.
func FusedLayerNorm ¶
FusedLayerNorm invokes BackendFusedLayerNorm on the underlying GraphImpl.
func FusedOpCaller ¶
func FusedOpCaller(fused, decomposed func() *graph.Node, useDecomposedAlternateVJP bool) (output *graph.Node, opFused bool)
FusedOpCaller invokes fused and falls back to decomposed if the backend returns ErrNotImplemented or if fusion is disabled via graph.FusionEnv.
func FusedOpCallerMulti ¶
func FusedOpCallerMulti(fused, decomposed func() []*graph.Node, useDecomposedAlternateVJP bool) (outputs []*graph.Node, opFused bool)
FusedOpCallerMulti is the multi-output variant of FusedOpCaller.
func FusedQuantizedDense ¶
FusedQuantizedDense invokes BackendFusedQuantizedDense on the underlying GraphImpl.
func FusedScaledDotProductAttention ¶
func FusedScaledDotProductAttention(query, key, value *graph.Node, axesLayout compute.AttentionAxesLayout, options *compute.ScaledDotProductAttentionConfig) (output *graph.Node, statesForVJP []*graph.Node)
FusedScaledDotProductAttention invokes BackendFusedScaledDotProductAttention on the underlying GraphImpl.
func QuantizationFromImpl ¶
func QuantizationFromImpl(q *graphimpl.Quantization) *graph.Quantization
QuantizationFromImpl converts a *graphimpl.Quantization back to *graph.Quantization.
func QuantizationToImpl ¶
func QuantizationToImpl(q *graph.Quantization) *graphimpl.Quantization
QuantizationToImpl converts a public *graph.Quantization to *graphimpl.Quantization.
func QuantizedDenseConfigFromImpl ¶
func QuantizedDenseConfigFromImpl(cfg graphimpl.QuantizedDenseConfig) graph.QuantizedDenseConfig
QuantizedDenseConfigFromImpl converts a graphimpl.QuantizedDenseConfig back to graph.QuantizedDenseConfig.
func QuantizedDenseConfigToImpl ¶
func QuantizedDenseConfigToImpl(cfg graph.QuantizedDenseConfig) graphimpl.QuantizedDenseConfig
QuantizedDenseConfigToImpl converts a public graph.QuantizedDenseConfig to graphimpl.QuantizedDenseConfig.
func QuantizedGather ¶
QuantizedGather invokes BackendQuantizedGather on the underlying GraphImpl.
func SharedConstant ¶
SharedConstant creates a Constant node in g reusing a backend constant compute.Value.
Types ¶
This section is empty.