graph

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultOpsetVersion int64 = 21
	MinOpsetVersion     int64 = 21
)

DefaultOpsetVersion is the default ai.onnx opset version emitted by compute-onnx. Opset 21 (IR version 9) provides broad compatibility across ONNX Runtime releases and execution providers (CPU, CUDA, ROCm/MIGraphX, WASM/WebGPU). Newer opsets (e.g., 23 for RMSNormalization) can be opted into via "opset=<N>".

Variables

This section is empty.

Functions

func DTypeToONNX

func DTypeToONNX(dt dtypes.DType) onnx.TensorProto_DataType

func GetSupportedOps

func GetSupportedOps() map[compute.OpType]bool

GetSupportedOps returns a copy of all supported compute.OpType operations.

func MakeScalar

func MakeScalar(f *Function, value any, dtype dtypes.DType) (compute.Value, error)

MakeScalar constructs a 0D scalar constant tensor for the given value and DType.

func ONNXDTypeToGoMLX

func ONNXDTypeToGoMLX(dt onnx.TensorProto_DataType) dtypes.DType

ONNXDTypeToGoMLX maps an ONNX TensorProto DataType to GoMLX DType.

func ONNXValueInfoToShape

func ONNXValueInfoToShape(valInfo *onnx.ValueInfoProto) shapes.Shape

ONNXValueInfoToShape converts an ONNX ValueInfoProto to a GoMLX Shape.

func ParseModelProto

func ParseModelProto(r io.Reader) (modelProto *onnx.ModelProto, modelBytes []byte, inputNames []string, inputShapes []shapes.Shape, outputNames []string, outputShapes []shapes.Shape, err error)

ParseModelProto parses ONNX model bytes and extracts input/output names and shapes.

func RemapAndMarshalModel

func RemapAndMarshalModel(modelProto *onnx.ModelProto, inputNames []string, outputNames []string) ([]byte, error)

RemapAndMarshalModel renames inputs and outputs on the ONNX ModelProto and serializes it to bytes.

func ShapeToONNX

func ShapeToONNX(shape shapes.Shape) *onnx.TensorShapeProto

Types

type Builder

type Builder struct {
	notimplemented.Builder
	// contains filtered or unexported fields
}

Builder implements compute.Builder for building ONNX computation graphs.

func NewBuilder

func NewBuilder(name string, compileFn CompilerFn) *Builder

NewBuilder creates a new graph Builder.

func (*Builder) Backend added in v0.1.30

func (b *Builder) Backend() compute.Backend

Backend returns the owning compute.Backend, if set.

func (*Builder) Compile

func (b *Builder) Compile() (compute.Executable, error)

func (*Builder) DeviceAssignment

func (b *Builder) DeviceAssignment(devices ...compute.DeviceNum) error

func (*Builder) ExecutionProvider added in v0.1.4

func (b *Builder) ExecutionProvider() executionprovider.Type

ExecutionProvider returns the target execution provider.

func (*Builder) Functions

func (b *Builder) Functions() map[string]*Function

Functions returns all registered functions in the builder.

func (*Builder) LogSeverity added in v0.1.4

func (b *Builder) LogSeverity() int

LogSeverity returns the log severity level for the builder.

func (*Builder) Main

func (b *Builder) Main() compute.Function

func (*Builder) MainFunction

func (b *Builder) MainFunction() *Function

MainFunction returns the strongly typed main *Function.

func (*Builder) Name

func (b *Builder) Name() string

func (*Builder) NewFunction

func (b *Builder) NewFunction(name string) (compute.Function, error)

func (*Builder) OpShape

func (b *Builder) OpShape(op compute.Value) (shapes.Shape, error)

func (*Builder) OpsetVersion added in v0.1.38

func (b *Builder) OpsetVersion() int64

OpsetVersion returns the target ai.onnx opset version for the builder.

func (*Builder) SetBackend added in v0.1.30

func (b *Builder) SetBackend(backend compute.Backend)

SetBackend associates the owning compute.Backend with this Builder.

func (*Builder) SetExecutionProvider added in v0.1.4

func (b *Builder) SetExecutionProvider(ep executionprovider.Type)

SetExecutionProvider sets the target execution provider.

func (*Builder) SetLogSeverity added in v0.1.4

func (b *Builder) SetLogSeverity(severity int)

SetLogSeverity sets the log severity level for the builder.

func (*Builder) SetOpsetVersion added in v0.1.38

func (b *Builder) SetOpsetVersion(version int64)

SetOpsetVersion sets the target ai.onnx opset version for the builder. Values <= 0 reset to DefaultOpsetVersion (21).

type CompiledModel

type CompiledModel struct {
	Model        *onnx.ModelProto
	ModelBytes   []byte
	InputNames   []string
	InputShapes  []shapes.Shape
	OutputNames  []string
	OutputShapes []shapes.Shape
	UsedDTypes   map[dtypes.DType]bool
}

CompiledModel contains the generated ONNX ModelProto and graph metadata.

func CompileToProto

func CompileToProto(b *Builder) (*CompiledModel, error)

CompileToProto translates a graph Builder AST into an ONNX ModelProto and serializes it to bytes.

type CompilerFn

type CompilerFn func(b *Builder) (compute.Executable, error)

CompilerFn is the function type used by Builder to compile a graph into a compute.Executable.

type Function

type Function struct {
	notimplemented.Function
	// contains filtered or unexported fields
}

func NewFunction

func NewFunction(name string, builder *Builder) *Function

func (*Function) Abs

func (f *Function) Abs(x compute.Value) (compute.Value, error)

func (*Function) Add

func (f *Function) Add(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) AddCustomNode

func (f *Function) AddCustomNode(opType string, inputs []*Node, shape shapes.Shape) *Node

AddCustomNode adds a custom node to the function graph (useful for testing or custom ops).

func (*Function) ArgMinMax

func (f *Function) ArgMinMax(x compute.Value, axis int, outputDType dtypes.DType, isMin bool) (compute.Value, error)

func (*Function) BitwiseAnd

func (f *Function) BitwiseAnd(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) BitwiseOr

func (f *Function) BitwiseOr(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) BitwiseXor

func (f *Function) BitwiseXor(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) BroadcastInDim

func (f *Function) BroadcastInDim(x compute.Value, outputShape shapes.Shape, broadcastAxes []int) (compute.Value, error)

func (*Function) Builder

func (f *Function) Builder() compute.Builder

func (*Function) Ceil

func (f *Function) Ceil(x compute.Value) (compute.Value, error)

func (*Function) Clamp added in v0.1.29

func (f *Function) Clamp(min, x, max compute.Value) (compute.Value, error)

Clamp supports both scalar and elementwise bounds using ONNX Max and Min.

func (*Function) Concatenate

func (f *Function) Concatenate(axis int, inputs ...compute.Value) (compute.Value, error)

func (*Function) Constant

func (f *Function) Constant(flat any, dims ...int) (compute.Value, error)

func (*Function) ConstantFromBuffer added in v0.1.30

func (f *Function) ConstantFromBuffer(buf compute.Buffer, donate bool) (compute.Value, error)

func (*Function) ConvGeneral

func (f *Function) ConvGeneral(input, kernel compute.Value, axes compute.ConvolveAxesConfig, strides []int, paddings [][2]int, inputDilations []int, kernelDilations []int, channelGroupCount int, batchGroupCount int) (compute.Value, error)

func (*Function) ConvertDType

func (f *Function) ConvertDType(operand compute.Value, targetDType dtypes.DType) (compute.Value, error)

func (*Function) Cos

func (f *Function) Cos(x compute.Value) (compute.Value, error)

func (*Function) CumSum added in v0.1.4

func (f *Function) CumSum(operand compute.Value, axis int, options compute.CumSumOptions) (compute.Value, error)

CumSum implements the ONNX CumSum operation.

func (*Function) Div

func (f *Function) Div(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) DotGeneral

func (f *Function) DotGeneral(
	lhs compute.Value,
	lhsContractingAxes []int,
	lhsBatchAxes []int,
	rhs compute.Value,
	rhsContractingAxes []int,
	rhsBatchAxes []int,
	config compute.DotGeneralConfig,
) (compute.Value, error)

DotGeneral performs a general dot product (matrix multiplication) of lhs and rhs. It maps the generalized contracting and batching axes of XLA semantics to ONNX Einsum.

func (*Function) DynamicBroadcastInDim added in v0.1.4

func (f *Function) DynamicBroadcastInDim(operand compute.Value, broadcastAxes []int, dimensions ...compute.DynamicDimensionSpec) (compute.Value, error)

func (*Function) DynamicDimensionSize

func (f *Function) DynamicDimensionSize(operand compute.Value, axis int) (compute.Value, error)

func (*Function) DynamicIota added in v0.1.4

func (f *Function) DynamicIota(dtype dtypes.DType, iotaAxis int, dimensions ...compute.DynamicDimensionSpec) (compute.Value, error)

DynamicIota constructs an ONNX Range node for dynamic/static iotaAxis and broadcasts it to target dimensions.

func (*Function) DynamicPad added in v0.1.4

func (f *Function) DynamicPad(x, fillValue compute.Value, axesConfig ...compute.DynamicPadAxis) (compute.Value, error)

DynamicPad injects padding on the start, end, or interior of the given operand.

func (*Function) DynamicReshape

func (f *Function) DynamicReshape(operand compute.Value, dimensions ...compute.DynamicDimensionSpec) (compute.Value, error)

func (*Function) DynamicShape

func (f *Function) DynamicShape(operand compute.Value) (compute.Value, error)

func (*Function) DynamicSlice

func (f *Function) DynamicSlice(operand compute.Value, startIndices []compute.Value, sliceDims []int) (compute.Value, error)

func (*Function) DynamicUpdateSlice

func (f *Function) DynamicUpdateSlice(operand, update compute.Value, startIndices []compute.Value) (compute.Value, error)

func (*Function) Equal

func (f *Function) Equal(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Erf

func (f *Function) Erf(x compute.Value) (compute.Value, error)

func (*Function) ExecutionProvider added in v0.1.5

func (f *Function) ExecutionProvider() executionprovider.Type

ExecutionProvider returns the execution provider configured for the function.

func (*Function) Exp

func (f *Function) Exp(x compute.Value) (compute.Value, error)

func (*Function) Expm1 added in v0.1.32

func (f *Function) Expm1(x compute.Value) (compute.Value, error)

func (*Function) Floor

func (f *Function) Floor(x compute.Value) (compute.Value, error)

func (*Function) FusedActivation added in v0.1.8

func (f *Function) FusedActivation(x compute.Value, cfg compute.ActivationConfig) (compute.Value, error)

FusedActivation applies the configured activation function using standard ONNX operators.

func (*Function) FusedAttentionQKVProjection

func (f *Function) FusedAttentionQKVProjection(
	x compute.Value,
	wQKV compute.Value,
	biasQ, biasK, biasV compute.Value,
	queryDim, keyValueDim int,
) (query, key, value compute.Value, err error)

FusedAttentionQKVProjection performs fused Query-Key-Value projection.

func (*Function) FusedDense

func (f *Function) FusedDense(x, weight, bias compute.Value, options compute.DenseConfig) (compute.Value, error)

FusedDense performs fused matmul + optional bias + optional activation.

func (*Function) FusedLayerNorm

func (f *Function) FusedLayerNorm(x, gamma, beta compute.Value, config compute.FusedLayerNormConfig) (compute.Value, error)

FusedLayerNorm applies layer normalization (ONNX LayerNormalization, opset 17+) or RMS normalization (ONNX RMSNormalization, opset 23+) over contiguous trailing axes.

func (*Function) FusedQuantizedDense

func (f *Function) FusedQuantizedDense(x, weight, bias compute.Value, options compute.FusedQuantizedDenseConfig) (compute.Value, error)

FusedQuantizedDense performs fused dequantization + matmul + optional bias + optional activation.

func (*Function) FusedScaledDotProductAttention

func (f *Function) FusedScaledDotProductAttention(
	query, key, value compute.Value,
	axesLayout compute.AttentionAxesLayout,
	options *compute.ScaledDotProductAttentionConfig) (output compute.Value, statesForVJP []compute.Value, err error)

FusedScaledDotProductAttention computes multi-head scaled dot-product attention.

func (*Function) FusedScaledDotProductAttentionVJP

func (f *Function) FusedScaledDotProductAttentionVJP(
	query, key, value compute.Value,
	axesLayout compute.AttentionAxesLayout,
	options *compute.ScaledDotProductAttentionConfig,
	output compute.Value, statesForVJP []compute.Value, dOutput compute.Value) (dQuery, dKey, dValue compute.Value, err error)

FusedScaledDotProductAttentionVJP computes gradients of FusedScaledDotProductAttention.

func (*Function) FusedSoftmax

func (f *Function) FusedSoftmax(x compute.Value, axis int) (compute.Value, error)

FusedSoftmax computes softmax along the specified axis using ONNX Softmax.

func (*Function) FusedTopK added in v0.1.29

func (f *Function) FusedTopK(operand compute.Value, k int, cfg compute.FusedTopKConfig) (values, indices compute.Value, err error)

FusedTopK returns sorted values and Int32 indices of the k largest (or smallest when cfg.Smallest is true) elements along cfg.Axis.

func (*Function) Gather

func (f *Function) Gather(
	operand compute.Value,
	startIndices compute.Value,
	indexVectorAxis int,
	offsetOutputAxes []int,
	collapsedSliceAxes []int,
	startIndexMap []int,
	sliceSizes []int,
	indicesAreSorted bool,
) (compute.Value, error)

Gather gathers slices from operand using coordinates specified by startIndices. It maps the generalized XLA Gather semantics to ONNX GatherND, Reshape, and Transpose. Packed sub-byte dtypes are not supported directly; use QuantizedGather or Bitcast to Uint8 first.

func (*Function) GreaterOrEqual

func (f *Function) GreaterOrEqual(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) GreaterThan

func (f *Function) GreaterThan(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Identity

func (f *Function) Identity(x compute.Value) (compute.Value, error)

func (*Function) Iota

func (f *Function) Iota(shape shapes.Shape, iotaAxis int) (compute.Value, error)

Iota constructs a Range operator for the iotaAxis dimension and then broadcasts using Expand (BroadcastInDim).

func (*Function) IsFinite added in v0.1.32

func (f *Function) IsFinite(x compute.Value) (compute.Value, error)

func (*Function) IsNaN added in v0.1.29

func (f *Function) IsNaN(x compute.Value) (compute.Value, error)

func (*Function) KnownDynamicAxisNames added in v0.1.29

func (f *Function) KnownDynamicAxisNames() sets.Set[string]

KnownDynamicAxisNames returns the set of dynamically defined axis names known by the function.

func (*Function) LessOrEqual

func (f *Function) LessOrEqual(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) LessThan

func (f *Function) LessThan(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Log

func (f *Function) Log(x compute.Value) (compute.Value, error)

func (*Function) Log1p

func (f *Function) Log1p(x compute.Value) (compute.Value, error)

func (*Function) LogSeverity added in v0.1.4

func (f *Function) LogSeverity() int

func (*Function) LogicalAnd

func (f *Function) LogicalAnd(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) LogicalNot

func (f *Function) LogicalNot(x compute.Value) (compute.Value, error)

func (*Function) LogicalOr

func (f *Function) LogicalOr(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) LogicalXor

func (f *Function) LogicalXor(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Logistic

func (f *Function) Logistic(x compute.Value) (compute.Value, error)

func (*Function) MakeScalar added in v0.1.4

func (f *Function) MakeScalar(value any, dtype dtypes.DType) (compute.Value, error)

MakeScalar constructs a 0D scalar constant tensor on Function for the given value and DType.

func (*Function) MakeValues added in v0.1.4

func (f *Function) MakeValues(value any, shape shapes.Shape) (compute.Value, error)

MakeValues constructs a constant tensor with shape filled with value by broadcasting a scalar.

func (*Function) MakeZeros added in v0.1.4

func (f *Function) MakeZeros(shape shapes.Shape) (compute.Value, error)

MakeZeros constructs a constant tensor with shape filled with zero by broadcasting a scalar zero.

func (*Function) Max

func (f *Function) Max(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Min

func (f *Function) Min(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Mul

func (f *Function) Mul(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Name

func (f *Function) Name() string

func (*Function) Neg

func (f *Function) Neg(x compute.Value) (compute.Value, error)

func (*Function) Nodes

func (f *Function) Nodes() []*Node

Nodes returns the recorded nodes of the function.

func (*Function) NonZero added in v0.1.29

func (f *Function) NonZero(operand compute.Value, cfg compute.NonZeroConfig) (compute.Value, error)

NonZero returns row-major coordinates of nonzero elements as an Int64 tensor with shape [count, rank] (or [rank, count] when cfg.Transpose is true).

func (*Function) NotEqual

func (f *Function) NotEqual(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) OptimizationBarrier added in v0.1.4

func (f *Function) OptimizationBarrier(operands ...compute.Value) ([]compute.Value, error)

OptimizationBarrier implements an optimization barrier. In ONNX Runtime, since we do not perform graph rewriting or CSE across barriers, this acts as Identity.

func (*Function) Pad added in v0.1.4

func (f *Function) Pad(x, fillValue compute.Value, axesConfig ...compute.PadAxis) (compute.Value, error)

Pad injects padding on the start, end, or interior of the given operand.

func (*Function) Parameter

func (f *Function) Parameter(name string, shape shapes.Shape, spec *compute.ShardingSpec) (compute.Value, error)

func (*Function) Params

func (f *Function) Params() []*Node

Params returns the parameters of the function.

func (*Function) Parent

func (f *Function) Parent() compute.Function

func (*Function) Pow

func (f *Function) Pow(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) QuantizedGather added in v0.1.31

func (f *Function) QuantizedGather(x, indices compute.Value, xQuantization *compute.Quantization) (compute.Value, error)

QuantizedGather performs a quantized row gather (embedding lookup) with on-the-fly unpacking / dequantization.

func (*Function) RNGBitGenerator

func (f *Function) RNGBitGenerator(
	state compute.Value,
	shape shapes.Shape,
	algorithm compute.RNGAlgorithm,
) (newState compute.Value, values compute.Value, err error)

RNGBitGenerator generates a tensor of the requested shape filled with uniform random bits using the specified algorithm (compute.RNGDefault, compute.RNGSplitMix64, or compute.RNGThreeFry).

func (*Function) Reduce

func (f *Function) Reduce(x compute.Value, opType compute.OpType, axes []int, keepDims bool) (compute.Value, error)

func (*Function) ReduceLogical

func (f *Function) ReduceLogical(x compute.Value, opType compute.OpType, axes []int, keepDims bool) (compute.Value, error)

func (*Function) ReduceLogicalAnd

func (f *Function) ReduceLogicalAnd(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceLogicalOr

func (f *Function) ReduceLogicalOr(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceLogicalXor

func (f *Function) ReduceLogicalXor(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceMax

func (f *Function) ReduceMax(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceMin

func (f *Function) ReduceMin(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceProduct

func (f *Function) ReduceProduct(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceSum

func (f *Function) ReduceSum(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) ReduceWindow

func (f *Function) ReduceWindow(
	operand compute.Value,
	reductionType compute.ReduceOpType,
	windowDimensions, strides, inputDilations, windowDilations []int,
	paddings [][2]int,
) (compute.Value, error)

func (*Function) Rem

func (f *Function) Rem(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Reshape

func (f *Function) Reshape(x compute.Value, newDimensions ...int) (compute.Value, error)

func (*Function) Return

func (f *Function) Return(outputs []compute.Value, shardings []*compute.ShardingSpec) error

func (*Function) Returns

func (f *Function) Returns() []*Node

Returns returns the return nodes of the function.

func (*Function) Reverse

func (f *Function) Reverse(x compute.Value, axes ...int) (compute.Value, error)

func (*Function) Round

func (f *Function) Round(x compute.Value) (compute.Value, error)

func (*Function) Rsqrt added in v0.1.27

func (f *Function) Rsqrt(x compute.Value) (compute.Value, error)

func (*Function) ScatterMax

func (f *Function) ScatterMax(
	operand, scatterIndices, updates compute.Value,
	indexVectorAxis int,
	updateWindowAxes, insertedWindowAxes, scatterAxesToOperandAxes []int,
	indicesAreSorted, uniqueIndices bool,
) (compute.Value, error)

func (*Function) ScatterMin

func (f *Function) ScatterMin(
	operand, scatterIndices, updates compute.Value,
	indexVectorAxis int,
	updateWindowAxes, insertedWindowAxes, scatterAxesToOperandAxes []int,
	indicesAreSorted, uniqueIndices bool,
) (compute.Value, error)

func (*Function) ScatterSum

func (f *Function) ScatterSum(
	operand, scatterIndices, updates compute.Value,
	indexVectorAxis int,
	updateWindowAxes, insertedWindowAxes, scatterAxesToOperandAxes []int,
	indicesAreSorted, uniqueIndices bool,
) (compute.Value, error)

func (*Function) SchedulingBarrier

func (f *Function) SchedulingBarrier(operand compute.Value, dependencies ...compute.Value) (compute.Value, error)

SchedulingBarrier introduces a scheduling barrier. Returned value is identity to the operand, but it is guaranteed to depend on all the dependencies.

Since ONNX Runtime doesn't natively support a scheduling barrier op, we "hack" it by means of a no-op: taking a scalar of each dependency, multiplying by 0, and adding them to the operand.

func (*Function) SelectAndScatterMax

func (f *Function) SelectAndScatterMax(operand compute.Value, source compute.Value, windowDimensions []int, windowStrides []int, paddings [][2]int) (compute.Value, error)

func (*Function) SetExecutionProvider added in v0.1.5

func (f *Function) SetExecutionProvider(ep executionprovider.Type)

SetExecutionProvider sets the execution provider configured for the function.

func (*Function) Shape

func (f *Function) Shape(v compute.Value) (shapes.Shape, error)

func (*Function) ShiftLeft

func (f *Function) ShiftLeft(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) ShiftRightArithmetic added in v0.1.24

func (f *Function) ShiftRightArithmetic(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) ShiftRightLogical

func (f *Function) ShiftRightLogical(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Sign

func (f *Function) Sign(x compute.Value) (compute.Value, error)

func (*Function) Sin

func (f *Function) Sin(x compute.Value) (compute.Value, error)

func (*Function) Slice

func (f *Function) Slice(x compute.Value, start []int, limit []int, stride []int) (compute.Value, error)

Slice extracts a slice from x specified by start, limit, and stride. Packed sub-byte dtypes are not supported directly; Bitcast to Uint8 or ConvertDType first.

func (*Function) Sqrt

func (f *Function) Sqrt(x compute.Value) (compute.Value, error)

func (*Function) Sub

func (f *Function) Sub(lhs, rhs compute.Value) (compute.Value, error)

func (*Function) Tanh

func (f *Function) Tanh(x compute.Value) (compute.Value, error)

func (*Function) Transpose

func (f *Function) Transpose(x compute.Value, permutation ...int) (compute.Value, error)

func (*Function) Where

func (f *Function) Where(condition compute.Value, onTrue compute.Value, onFalse compute.Value) (compute.Value, error)

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents an operation or constant in the ONNX computation graph.

func (*Node) Name

func (n *Node) Name() string

Name returns the node's name.

func (*Node) OpType

func (n *Node) OpType() string

OpType returns the node's operator type.

func (*Node) Shape

func (n *Node) Shape() shapes.Shape

Shape returns the shape of the node's output tensor.

Jump to

Keyboard shortcuts

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