compute_graph

package
v0.0.0-...-890d392 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ONNXOperators = []ONNXOperator{}/* 222 elements not displayed */

Functions

This section is empty.

Types

type Abs

type Abs struct {
	*OPSNode
	OPSTensor
}

func NewAbs

func NewAbs(name string, a *GraphTensor) *Abs

func (*Abs) Backward

func (m *Abs) Backward(grad *tensor.Tensor)

func (*Abs) Forward

func (m *Abs) Forward() *tensor.Tensor

func (*Abs) GetOutput

func (m *Abs) GetOutput() *GraphTensor

type Add

type Add struct {
	*OPSNode
	Name     string
	Children []*GraphTensor
	// contains filtered or unexported fields
}

func NewAdd

func NewAdd(name string, a, b *GraphTensor) *Add

func (*Add) Backward

func (a *Add) Backward(grad *tensor.Tensor)

func (*Add) Forward

func (a *Add) Forward() *tensor.Tensor

func (*Add) GetChildren

func (a *Add) GetChildren() []Node

func (*Add) GetName

func (a *Add) GetName() string

func (*Add) GetOutput

func (a *Add) GetOutput() *GraphTensor

func (*Add) ResetComputed

func (a *Add) ResetComputed()

type And

type And struct {
	*OPSNode
	OPSTensor
}

func NewAnd

func NewAnd(name string, a, b *GraphTensor) *And

func (*And) Backward

func (m *And) Backward(grad *tensor.Tensor)

func (*And) Forward

func (m *And) Forward() *tensor.Tensor

func (*And) GetOutput

func (m *And) GetOutput() *GraphTensor

type AveragePool

type AveragePool struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewAveragePool

func NewAveragePool(name string, input *GraphTensor, kernel, stride, padding []int) *AveragePool

func (*AveragePool) Backward

func (m *AveragePool) Backward(grad *tensor.Tensor)

func (*AveragePool) Forward

func (m *AveragePool) Forward() *tensor.Tensor

func (*AveragePool) GetOutput

func (m *AveragePool) GetOutput() *GraphTensor

type BatchNormalization

type BatchNormalization struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewBatchNormalization

func NewBatchNormalization(name string, input, gamma, beta *GraphTensor, epsilon, momentum float32) *BatchNormalization

func (*BatchNormalization) Backward

func (bn *BatchNormalization) Backward(grad *tensor.Tensor)

func (*BatchNormalization) Forward

func (bn *BatchNormalization) Forward() *tensor.Tensor

func (*BatchNormalization) GetOutput

func (m *BatchNormalization) GetOutput() *GraphTensor

type Ceil

type Ceil struct {
	*OPSNode
	OPSTensor
}

func NewCeil

func NewCeil(name string, a *GraphTensor) *Ceil

func (*Ceil) Backward

func (m *Ceil) Backward(grad *tensor.Tensor)

func (*Ceil) Forward

func (m *Ceil) Forward() *tensor.Tensor

func (*Ceil) GetOutput

func (m *Ceil) GetOutput() *GraphTensor

type ComputationalGraph

type ComputationalGraph struct {
	Nodes   []Node
	Tensors map[string]*GraphTensor

	NodeCount int
	// contains filtered or unexported fields
}

func NewComputationalGraph

func NewComputationalGraph() *ComputationalGraph

func (*ComputationalGraph) Backward

func (g *ComputationalGraph) Backward()

func (*ComputationalGraph) Forward

func (g *ComputationalGraph) Forward()

func (*ComputationalGraph) GetOutput

func (g *ComputationalGraph) GetOutput() *GraphTensor

func (*ComputationalGraph) GetTensorByName

func (g *ComputationalGraph) GetTensorByName(name string) *GraphTensor

func (*ComputationalGraph) GetTensors

func (g *ComputationalGraph) GetTensors() map[string]*GraphTensor

func (*ComputationalGraph) NewGraphTensor

func (g *ComputationalGraph) NewGraphTensor(data []float32, shape []int, name string) *GraphTensor

func (*ComputationalGraph) PrintStructure

func (g *ComputationalGraph) PrintStructure()

func (*ComputationalGraph) Reset

func (g *ComputationalGraph) Reset()

func (*ComputationalGraph) SetInput

func (g *ComputationalGraph) SetInput(t *GraphTensor, data []float32)

func (*ComputationalGraph) SetOutput

func (g *ComputationalGraph) SetOutput(t *GraphTensor)

func (*ComputationalGraph) ToONNXModel

func (g *ComputationalGraph) ToONNXModel() (*ONNX, error)

type Conv

type Conv struct {
	*OPSNode
	OPSTensor
	StrideH int
	StrideW int
	PadH    int
	PadW    int
	// contains filtered or unexported fields
}

func NewConv

func NewConv(name string, strideH, strideW, padH, padW int, input, weight *GraphTensor) *Conv

func (*Conv) Backward

func (m *Conv) Backward(grad *tensor.Tensor)

func (*Conv) Forward

func (m *Conv) Forward() *tensor.Tensor

func (*Conv) GetOutput

func (m *Conv) GetOutput() *GraphTensor

type Div

type Div struct {
	*OPSNode
	OPSTensor
}

func NewDiv

func NewDiv(name string, a, b *GraphTensor) *Div

func (*Div) Backward

func (m *Div) Backward(grad *tensor.Tensor)

func (*Div) Forward

func (m *Div) Forward() *tensor.Tensor

func (*Div) GetOutput

func (m *Div) GetOutput() *GraphTensor

type Dropout

type Dropout struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewDropout

func NewDropout(name string, input *GraphTensor, p float32) *Dropout

func (*Dropout) Backward

func (d *Dropout) Backward(grad *tensor.Tensor)

func (*Dropout) Forward

func (d *Dropout) Forward() *tensor.Tensor

func (*Dropout) GetOutput

func (m *Dropout) GetOutput() *GraphTensor

type Exp

type Exp struct {
	*OPSNode
	OPSTensor
}

func NewExp

func NewExp(name string, a *GraphTensor) *Exp

func (*Exp) Backward

func (m *Exp) Backward(grad *tensor.Tensor)

func (*Exp) Forward

func (m *Exp) Forward() *tensor.Tensor

func (*Exp) GetOutput

func (m *Exp) GetOutput() *GraphTensor

type Flatten

type Flatten struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewFlatten

func NewFlatten(name string, a *GraphTensor) *Flatten

func (*Flatten) Backward

func (m *Flatten) Backward(grad *tensor.Tensor)

func (*Flatten) Forward

func (m *Flatten) Forward() *tensor.Tensor

func (*Flatten) GetOutput

func (m *Flatten) GetOutput() *GraphTensor

type Floor

type Floor struct {
	*OPSNode
	OPSTensor
}

func NewFloor

func NewFloor(name string, a *GraphTensor) *Floor

func (*Floor) Backward

func (m *Floor) Backward(grad *tensor.Tensor)

func (*Floor) Forward

func (m *Floor) Forward() *tensor.Tensor

func (*Floor) GetOutput

func (m *Floor) GetOutput() *GraphTensor

type Gemm

type Gemm struct {
	*OPSNode
	OPSTensor
	TransA bool
	TransB bool
	Alpha  float32
	Beta   float32
}

func NewGemm

func NewGemm(name string, transA, transB bool, alpha, beta float32, a, b, c *GraphTensor) *Gemm

func (*Gemm) Backward

func (m *Gemm) Backward(grad *tensor.Tensor)

func (*Gemm) Forward

func (m *Gemm) Forward() *tensor.Tensor

func (*Gemm) GetOutput

func (m *Gemm) GetOutput() *GraphTensor

type GlobalAveragePool

type GlobalAveragePool struct {
	*OPSNode
	OPSTensor
}

func NewGlobalAveragePool

func NewGlobalAveragePool(name string, input *GraphTensor) *GlobalAveragePool

func (*GlobalAveragePool) Backward

func (m *GlobalAveragePool) Backward(grad *tensor.Tensor)

func (*GlobalAveragePool) Forward

func (m *GlobalAveragePool) Forward() *tensor.Tensor

func (*GlobalAveragePool) GetOutput

func (m *GlobalAveragePool) GetOutput() *GraphTensor

type GlobalMaxPool

type GlobalMaxPool struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewGlobalMaxPool

func NewGlobalMaxPool(name string, input *GraphTensor) *GlobalMaxPool

func (*GlobalMaxPool) Backward

func (m *GlobalMaxPool) Backward(grad *tensor.Tensor)

func (*GlobalMaxPool) Forward

func (m *GlobalMaxPool) Forward() *tensor.Tensor

func (*GlobalMaxPool) GetOutput

func (m *GlobalMaxPool) GetOutput() *GraphTensor

type GraphExport

type GraphExport struct {
	Nodes   []NodeExport   `json:"nodes"`
	Tensors []TensorExport `json:"tensors"`
	Output  string         `json:"output"`
}

type GraphTensor

type GraphTensor struct {
	Name string

	Shape []int
	Node  Node
	Graph *ComputationalGraph
	// contains filtered or unexported fields
}

func (*GraphTensor) Abs

func (t *GraphTensor) Abs(names ...string) *GraphTensor

func (*GraphTensor) Add

func (t *GraphTensor) Add(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) And

func (t *GraphTensor) And(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) AveragePool

func (t *GraphTensor) AveragePool(kernel, stride, padding []int, name string) *GraphTensor

func (*GraphTensor) BatchNormalization

func (t *GraphTensor) BatchNormalization(gamma, beta *GraphTensor, epsilon, momentum float32, names ...string) *GraphTensor

func (*GraphTensor) Ceil

func (t *GraphTensor) Ceil(names ...string) *GraphTensor

func (*GraphTensor) Conv

func (t *GraphTensor) Conv(weight *GraphTensor, stride, padding []int, names ...string) *GraphTensor

func (*GraphTensor) Div

func (t *GraphTensor) Div(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) Dropout

func (t *GraphTensor) Dropout(p float32, names ...string) *GraphTensor

func (*GraphTensor) Exp

func (t *GraphTensor) Exp(names ...string) *GraphTensor

func (*GraphTensor) Flatten

func (t *GraphTensor) Flatten(names ...string) *GraphTensor

func (*GraphTensor) Floor

func (t *GraphTensor) Floor(names ...string) *GraphTensor

func (*GraphTensor) Gemm

func (t *GraphTensor) Gemm(b, c *GraphTensor, transA, transB bool, alpha, beta float32, names ...string) *GraphTensor

func (*GraphTensor) GlobalAveragePool

func (t *GraphTensor) GlobalAveragePool(name string) *GraphTensor

func (*GraphTensor) GlobalMaxPool

func (t *GraphTensor) GlobalMaxPool(name string) *GraphTensor

func (*GraphTensor) Grad

func (t *GraphTensor) Grad() *tensor.Tensor

func (*GraphTensor) Hardmax

func (t *GraphTensor) Hardmax(names ...string) *GraphTensor

func (*GraphTensor) InstanceNormalization

func (t *GraphTensor) InstanceNormalization(epsilon float32, names ...string) *GraphTensor

func (*GraphTensor) IsComputed

func (t *GraphTensor) IsComputed() bool

func (*GraphTensor) LRN

func (t *GraphTensor) LRN(size int, alpha, beta, k float32, names ...string) *GraphTensor

func (*GraphTensor) Log

func (t *GraphTensor) Log(names ...string) *GraphTensor

func (*GraphTensor) LogSoftmax

func (t *GraphTensor) LogSoftmax(names ...string) *GraphTensor

func (*GraphTensor) LpNormalization

func (t *GraphTensor) LpNormalization(p float32, axis int, epsilon float32, names ...string) *GraphTensor

func (*GraphTensor) LpPool

func (t *GraphTensor) LpPool(kernel, strides []int, p float32, names ...string) *GraphTensor

func (*GraphTensor) MatMul

func (t *GraphTensor) MatMul(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) MaxPool

func (t *GraphTensor) MaxPool(kernel, stride, padding []int, name string) *GraphTensor

func (*GraphTensor) MaxRoiPool

func (t *GraphTensor) MaxRoiPool(rois *GraphTensor, pooledHeight, pooledWidth int, names ...string) *GraphTensor

func (*GraphTensor) Multiply

func (t *GraphTensor) Multiply(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) Neg

func (t *GraphTensor) Neg(names ...string) *GraphTensor

func (*GraphTensor) Not

func (t *GraphTensor) Not(names ...string) *GraphTensor

func (*GraphTensor) Or

func (t *GraphTensor) Or(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) Pad

func (t *GraphTensor) Pad(pads [][2]int, val float32, names ...string) *GraphTensor

func (*GraphTensor) Pow

func (t *GraphTensor) Pow(exponent *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) ReLU

func (t *GraphTensor) ReLU(names ...string) *GraphTensor

func (*GraphTensor) Reciprocal

func (t *GraphTensor) Reciprocal(names ...string) *GraphTensor

func (*GraphTensor) Reshape

func (t *GraphTensor) Reshape(shape []int, names ...string) *GraphTensor

func (*GraphTensor) SetComputed

func (t *GraphTensor) SetComputed(computed bool)

func (*GraphTensor) SetGrad

func (t *GraphTensor) SetGrad(grad *tensor.Tensor)

func (*GraphTensor) SetValue

func (t *GraphTensor) SetValue(value *tensor.Tensor)

func (*GraphTensor) Sigmoid

func (t *GraphTensor) Sigmoid(names ...string) *GraphTensor

func (*GraphTensor) Slice

func (t *GraphTensor) Slice(starts, ends []int, names ...string) *GraphTensor

func (*GraphTensor) Softmax

func (t *GraphTensor) Softmax(names ...string) *GraphTensor

func (*GraphTensor) Sqrt

func (t *GraphTensor) Sqrt(names ...string) *GraphTensor

func (*GraphTensor) Squeeze

func (t *GraphTensor) Squeeze(names ...string) *GraphTensor

func (*GraphTensor) Sub

func (t *GraphTensor) Sub(other *GraphTensor, names ...string) *GraphTensor

func (*GraphTensor) Sum

func (t *GraphTensor) Sum(names ...string) *GraphTensor

func (*GraphTensor) Tanh

func (t *GraphTensor) Tanh(names ...string) *GraphTensor

func (*GraphTensor) Tile

func (t *GraphTensor) Tile(repeats []int, names ...string) *GraphTensor

func (*GraphTensor) Transpose

func (t *GraphTensor) Transpose(perm []int, names ...string) *GraphTensor

func (*GraphTensor) Unsqueeze

func (t *GraphTensor) Unsqueeze(axis int, names ...string) *GraphTensor

func (*GraphTensor) UpdateAll

func (t *GraphTensor) UpdateAll(graphTensor *GraphTensor)

func (*GraphTensor) Value

func (t *GraphTensor) Value() *tensor.Tensor

func (*GraphTensor) Xor

func (t *GraphTensor) Xor(other *GraphTensor, names ...string) *GraphTensor

type Hardmax

type Hardmax struct {
	*OPSNode
	OPSTensor
}

func NewHardmax

func NewHardmax(name string, a *GraphTensor) *Hardmax

func (*Hardmax) Backward

func (m *Hardmax) Backward(grad *tensor.Tensor)

func (*Hardmax) Forward

func (m *Hardmax) Forward() *tensor.Tensor

func (*Hardmax) GetOutput

func (m *Hardmax) GetOutput() *GraphTensor

type InputNode

type InputNode struct {
	Name string
	// contains filtered or unexported fields
}

func (*InputNode) Backward

func (n *InputNode) Backward(grad *tensor.Tensor)

func (*InputNode) Forward

func (n *InputNode) Forward() *tensor.Tensor

func (*InputNode) GetChildren

func (n *InputNode) GetChildren() []Node

func (*InputNode) GetGrad

func (n *InputNode) GetGrad() *tensor.Tensor

func (*InputNode) GetName

func (n *InputNode) GetName() string

func (*InputNode) GetONNXNodeInfo

func (m *InputNode) GetONNXNodeInfo() *ONNXNodeInfo

func (*InputNode) GetOutput

func (n *InputNode) GetOutput() *GraphTensor

func (*InputNode) ResetComputed

func (n *InputNode) ResetComputed()

type InstanceNormalization

type InstanceNormalization struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewInstanceNormalization

func NewInstanceNormalization(name string, input *GraphTensor, epsilon float32) *InstanceNormalization

func (*InstanceNormalization) Backward

func (m *InstanceNormalization) Backward(grad *tensor.Tensor)

func (*InstanceNormalization) Forward

func (m *InstanceNormalization) Forward() *tensor.Tensor

func (*InstanceNormalization) GetOutput

func (m *InstanceNormalization) GetOutput() *GraphTensor

type LRN

type LRN struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewLRN

func NewLRN(name string, input *GraphTensor, size int, alpha, beta, k float32) *LRN

func (*LRN) Backward

func (l *LRN) Backward(grad *tensor.Tensor)

func (*LRN) Forward

func (l *LRN) Forward() *tensor.Tensor

func (*LRN) GetOutput

func (m *LRN) GetOutput() *GraphTensor

type Log

type Log struct {
	*OPSNode
	OPSTensor
}

func NewLog

func NewLog(name string, a *GraphTensor) *Log

func (*Log) Backward

func (m *Log) Backward(grad *tensor.Tensor)

func (*Log) Forward

func (m *Log) Forward() *tensor.Tensor

func (*Log) GetOutput

func (m *Log) GetOutput() *GraphTensor

type LogSoftmax

type LogSoftmax struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewLogSoftmax

func NewLogSoftmax(name string, a *GraphTensor) *LogSoftmax

func (*LogSoftmax) Backward

func (m *LogSoftmax) Backward(grad *tensor.Tensor)

func (*LogSoftmax) Forward

func (m *LogSoftmax) Forward() *tensor.Tensor

func (*LogSoftmax) GetOutput

func (m *LogSoftmax) GetOutput() *GraphTensor

type LpNormalization

type LpNormalization struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewLpNormalization

func NewLpNormalization(name string, input *GraphTensor, p float32, axis int, epsilon float32) *LpNormalization

func (*LpNormalization) Backward

func (m *LpNormalization) Backward(grad *tensor.Tensor)

func (*LpNormalization) Forward

func (m *LpNormalization) Forward() *tensor.Tensor

func (*LpNormalization) GetOutput

func (m *LpNormalization) GetOutput() *GraphTensor

type LpPool

type LpPool struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewLpPool

func NewLpPool(name string, input *GraphTensor, kernel, strides []int, p float32) *LpPool

func (*LpPool) Backward

func (m *LpPool) Backward(grad *tensor.Tensor)

func (*LpPool) Forward

func (m *LpPool) Forward() *tensor.Tensor

func (*LpPool) GetOutput

func (m *LpPool) GetOutput() *GraphTensor

type MatMul

type MatMul struct {
	*OPSNode
	OPSTensor
}

func NewMatMul

func NewMatMul(name string, a, b *GraphTensor) *MatMul

func (*MatMul) Backward

func (m *MatMul) Backward(grad *tensor.Tensor)

func (*MatMul) Forward

func (m *MatMul) Forward() *tensor.Tensor

func (*MatMul) GetOutput

func (m *MatMul) GetOutput() *GraphTensor

type MaxPool

type MaxPool struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewMaxPool

func NewMaxPool(name string, input *GraphTensor, kernel, stride, padding []int) *MaxPool

func (*MaxPool) Backward

func (m *MaxPool) Backward(grad *tensor.Tensor)

func (*MaxPool) Forward

func (m *MaxPool) Forward() *tensor.Tensor

func (*MaxPool) GetOutput

func (m *MaxPool) GetOutput() *GraphTensor

type MaxRoiPool

type MaxRoiPool struct {
	*OPSNode
	OPSTensor
	PooledHeight int
	PooledWidth  int
	// contains filtered or unexported fields
}

func NewMaxRoiPool

func NewMaxRoiPool(name string, featureMap, rois *GraphTensor, pooledHeight, pooledWidth int) *MaxRoiPool

func (*MaxRoiPool) Backward

func (m *MaxRoiPool) Backward(grad *tensor.Tensor)

func (*MaxRoiPool) Forward

func (m *MaxRoiPool) Forward() *tensor.Tensor

func (*MaxRoiPool) GetOutput

func (m *MaxRoiPool) GetOutput() *GraphTensor

type Multiply

type Multiply struct {
	*OPSNode
	Name     string
	Children []*GraphTensor
	// contains filtered or unexported fields
}

func NewMultiply

func NewMultiply(name string, a, b *GraphTensor) *Multiply

func (*Multiply) Backward

func (m *Multiply) Backward(grad *tensor.Tensor)

func (*Multiply) Forward

func (m *Multiply) Forward() *tensor.Tensor

func (*Multiply) GetChildren

func (m *Multiply) GetChildren() []Node

func (*Multiply) GetName

func (m *Multiply) GetName() string

func (*Multiply) GetOutput

func (m *Multiply) GetOutput() *GraphTensor

func (*Multiply) ResetComputed

func (m *Multiply) ResetComputed()

type Neg

type Neg struct {
	*OPSNode
	OPSTensor
}

func NewNeg

func NewNeg(name string, a *GraphTensor) *Neg

func (*Neg) Backward

func (m *Neg) Backward(grad *tensor.Tensor)

func (*Neg) Forward

func (m *Neg) Forward() *tensor.Tensor

func (*Neg) GetOutput

func (m *Neg) GetOutput() *GraphTensor

type Node

type Node interface {
	Forward() *tensor.Tensor
	Backward(grad *tensor.Tensor)
	GetName() string
	ResetComputed()
	//OPSNode
	GetONNXNodeInfo() *ONNXNodeInfo
	GetChildren() []Node
	GetOutput() *GraphTensor
}

type NodeExport

type NodeExport struct {
	Name   string   `json:"name"`
	Type   string   `json:"type"`
	Inputs []string `json:"inputs"`
	Output string   `json:"output"`
}

type Not

type Not struct {
	*OPSNode
	OPSTensor
}

func NewNot

func NewNot(name string, a *GraphTensor) *Not

func (*Not) Backward

func (m *Not) Backward(grad *tensor.Tensor)

func (*Not) Forward

func (m *Not) Forward() *tensor.Tensor

func (*Not) GetOutput

func (m *Not) GetOutput() *GraphTensor

type ONNX

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

func (*ONNX) SaveONNX

func (m *ONNX) SaveONNX(filename string) error

type ONNXNodeInfo

type ONNXNodeInfo struct {
	Name           string
	ProducedTensor bool
}

type ONNXOperator

type ONNXOperator struct {
	Name             string
	InputPCount      int
	OutputPCount     int
	Ignore           bool
	AliasList        []string
	NodeRegistryFunc func(name string, children []*GraphTensor, output *GraphTensor) Node
}

func GetONNXNodeInfoByName

func GetONNXNodeInfoByName(name string) *ONNXOperator

type OPSNode

type OPSNode struct {
	ONNXName           string
	ONNXProducedTensor bool
}

func NewOPSNode

func NewOPSNode(in OPSNode) *OPSNode

func (*OPSNode) GetONNXNodeInfo

func (m *OPSNode) GetONNXNodeInfo() *ONNXNodeInfo

type OPSTensor

type OPSTensor struct {
	Name     string
	Children []*GraphTensor
	// contains filtered or unexported fields
}

func (*OPSTensor) GetChildren

func (m *OPSTensor) GetChildren() []Node

func (*OPSTensor) GetName

func (m *OPSTensor) GetName() string

func (*OPSTensor) GetTensorOutput

func (m *OPSTensor) GetTensorOutput() *GraphTensor

func (*OPSTensor) ResetComputed

func (m *OPSTensor) ResetComputed()

type Or

type Or struct {
	*OPSNode
	OPSTensor
}

func NewOr

func NewOr(name string, a, b *GraphTensor) *Or

func (*Or) Backward

func (m *Or) Backward(grad *tensor.Tensor)

func (*Or) Forward

func (m *Or) Forward() *tensor.Tensor

func (*Or) GetOutput

func (m *Or) GetOutput() *GraphTensor

type Pad

type Pad struct {
	*OPSNode
	OPSTensor
	Pads [][2]int
	Val  float32
}

func NewPad

func NewPad(name string, a *GraphTensor, pads [][2]int, val float32) *Pad

func (*Pad) Backward

func (m *Pad) Backward(grad *tensor.Tensor)

func (*Pad) Forward

func (m *Pad) Forward() *tensor.Tensor

func (*Pad) GetOutput

func (m *Pad) GetOutput() *GraphTensor

type Pow

type Pow struct {
	*OPSNode
	OPSTensor
}

func NewPow

func NewPow(name string, base, exponent *GraphTensor) *Pow

func (*Pow) Backward

func (m *Pow) Backward(grad *tensor.Tensor)

func (*Pow) Forward

func (m *Pow) Forward() *tensor.Tensor

func (*Pow) GetOutput

func (m *Pow) GetOutput() *GraphTensor

type ReLU

type ReLU struct {
	*OPSNode
	OPSTensor
}

func NewReLU

func NewReLU(name string, a *GraphTensor) *ReLU

func (*ReLU) Backward

func (m *ReLU) Backward(grad *tensor.Tensor)

func (*ReLU) Forward

func (m *ReLU) Forward() *tensor.Tensor

func (*ReLU) GetOutput

func (m *ReLU) GetOutput() *GraphTensor

type Reciprocal

type Reciprocal struct {
	*OPSNode
	OPSTensor
}

func NewReciprocal

func NewReciprocal(name string, a *GraphTensor) *Reciprocal

func (*Reciprocal) Backward

func (m *Reciprocal) Backward(grad *tensor.Tensor)

func (*Reciprocal) Forward

func (m *Reciprocal) Forward() *tensor.Tensor

func (*Reciprocal) GetOutput

func (m *Reciprocal) GetOutput() *GraphTensor

type Reshape

type Reshape struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewReshape

func NewReshape(name string, a *GraphTensor, shape []int) *Reshape

func (*Reshape) Backward

func (m *Reshape) Backward(grad *tensor.Tensor)

func (*Reshape) Forward

func (m *Reshape) Forward() *tensor.Tensor

func (*Reshape) GetOutput

func (m *Reshape) GetOutput() *GraphTensor

type Sigmoid

type Sigmoid struct {
	*OPSNode
	OPSTensor
}

func NewSigmoid

func NewSigmoid(name string, a *GraphTensor) *Sigmoid

func (*Sigmoid) Backward

func (m *Sigmoid) Backward(grad *tensor.Tensor)

func (*Sigmoid) Forward

func (m *Sigmoid) Forward() *tensor.Tensor

func (*Sigmoid) GetOutput

func (m *Sigmoid) GetOutput() *GraphTensor

type Slice

type Slice struct {
	*OPSNode
	OPSTensor
	Starts []int
	Ends   []int
}

func NewSlice

func NewSlice(name string, a *GraphTensor, starts, ends []int) *Slice

func (*Slice) Backward

func (m *Slice) Backward(grad *tensor.Tensor)

func (*Slice) Forward

func (m *Slice) Forward() *tensor.Tensor

func (*Slice) GetOutput

func (m *Slice) GetOutput() *GraphTensor

type Softmax

type Softmax struct {
	*OPSNode
	OPSTensor
}

func NewSoftmax

func NewSoftmax(name string, a *GraphTensor) *Softmax

func (*Softmax) Backward

func (m *Softmax) Backward(grad *tensor.Tensor)

func (*Softmax) Forward

func (m *Softmax) Forward() *tensor.Tensor

func (*Softmax) GetOutput

func (m *Softmax) GetOutput() *GraphTensor

type Sqrt

type Sqrt struct {
	*OPSNode
	OPSTensor
}

func NewSqrt

func NewSqrt(name string, a *GraphTensor) *Sqrt

func (*Sqrt) Backward

func (m *Sqrt) Backward(grad *tensor.Tensor)

func (*Sqrt) Forward

func (m *Sqrt) Forward() *tensor.Tensor

func (*Sqrt) GetOutput

func (m *Sqrt) GetOutput() *GraphTensor

type Squeeze

type Squeeze struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewSqueeze

func NewSqueeze(name string, a *GraphTensor) *Squeeze

func (*Squeeze) Backward

func (s *Squeeze) Backward(grad *tensor.Tensor)

func (*Squeeze) Forward

func (s *Squeeze) Forward() *tensor.Tensor

func (*Squeeze) GetOutput

func (m *Squeeze) GetOutput() *GraphTensor

type Sub

type Sub struct {
	*OPSNode
	OPSTensor
}

func NewSub

func NewSub(name string, a, b *GraphTensor) *Sub

func (*Sub) Backward

func (m *Sub) Backward(grad *tensor.Tensor)

func (*Sub) Forward

func (m *Sub) Forward() *tensor.Tensor

func (*Sub) GetOutput

func (m *Sub) GetOutput() *GraphTensor

type Sum

type Sum struct {
	Name     string
	Children []*GraphTensor
	// contains filtered or unexported fields
}

func NewSum

func NewSum(name string, a *GraphTensor) *Sum

func (*Sum) Backward

func (m *Sum) Backward(grad *tensor.Tensor)

func (*Sum) Forward

func (m *Sum) Forward() *tensor.Tensor

func (*Sum) GetChildren

func (m *Sum) GetChildren() []Node

func (*Sum) GetName

func (m *Sum) GetName() string

func (*Sum) GetONNXNodeInfo

func (m *Sum) GetONNXNodeInfo() *ONNXNodeInfo

func (*Sum) GetOutput

func (m *Sum) GetOutput() *GraphTensor

func (*Sum) ResetComputed

func (m *Sum) ResetComputed()

type Tanh

type Tanh struct {
	*OPSNode
	OPSTensor
}

func NewTanh

func NewTanh(name string, a *GraphTensor) *Tanh

func (*Tanh) Backward

func (m *Tanh) Backward(grad *tensor.Tensor)

func (*Tanh) Forward

func (m *Tanh) Forward() *tensor.Tensor

func (*Tanh) GetOutput

func (m *Tanh) GetOutput() *GraphTensor

type TensorExport

type TensorExport struct {
	Name  string    `json:"name"`
	Value []float32 `json:"value"`
	Grad  []float32 `json:"grad"`
}

type Tile

type Tile struct {
	*OPSNode
	OPSTensor
	Repeats []int
}

func NewTile

func NewTile(name string, a *GraphTensor, repeats []int) *Tile

func (*Tile) Backward

func (m *Tile) Backward(grad *tensor.Tensor)

func (*Tile) Forward

func (m *Tile) Forward() *tensor.Tensor

func (*Tile) GetOutput

func (m *Tile) GetOutput() *GraphTensor

type Transpose

type Transpose struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewTranspose

func NewTranspose(name string, a *GraphTensor, perm, inverse []int) *Transpose

func (*Transpose) Backward

func (m *Transpose) Backward(grad *tensor.Tensor)

func (*Transpose) Forward

func (m *Transpose) Forward() *tensor.Tensor

func (*Transpose) GetOutput

func (m *Transpose) GetOutput() *GraphTensor

type Unsqueeze

type Unsqueeze struct {
	*OPSNode
	OPSTensor
	// contains filtered or unexported fields
}

func NewUnsqueeze

func NewUnsqueeze(name string, a *GraphTensor, axis int) *Unsqueeze

func (*Unsqueeze) Backward

func (u *Unsqueeze) Backward(grad *tensor.Tensor)

func (*Unsqueeze) Forward

func (u *Unsqueeze) Forward() *tensor.Tensor

func (*Unsqueeze) GetOutput

func (m *Unsqueeze) GetOutput() *GraphTensor

type Xor

type Xor struct {
	*OPSNode
	OPSTensor
}

func NewXor

func NewXor(name string, a, b *GraphTensor) *Xor

func (*Xor) Backward

func (m *Xor) Backward(grad *tensor.Tensor)

func (*Xor) Forward

func (m *Xor) Forward() *tensor.Tensor

func (*Xor) GetOutput

func (m *Xor) GetOutput() *GraphTensor

Jump to

Keyboard shortcuts

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