Documentation
¶
Overview ¶
Package core provides core neural network layer implementations.
Package core provides core layer implementations for the Zerfoo ML framework.
Package core provides core layer implementations for the Zerfoo ML framework.
Package core provides core layer implementations for the Zerfoo ML framework.
Package core provides core layer implementations for the Zerfoo ML framework.
Package core provides core neural network layer implementations.
Package core provides core neural network layer implementations.
Package core provides core layer implementations for the Zerfoo ML framework.
Package core provides the Shape layer for the Zerfoo ML framework.
Package core provides core neural network layer implementations.
Package core provides core layer implementations for the Zerfoo ML framework.
Package core provides core layer implementations for the Zerfoo ML framework.
Index ¶
- func BuildCast[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildConcat[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildMatMul[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildMul[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildReshape[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildRotaryEmbedding[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], name string, ...) (graph.Node[T], error)
- func BuildShape[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildSpectralFingerprint[T tensor.Numeric](engine compute.Engine[T], ops numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildSub[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- func BuildUnsqueeze[T tensor.Numeric](engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, ...) (graph.Node[T], error)
- type Add
- func (a *Add[T]) Attributes() map[string]any
- func (a *Add[T]) Backward(_ context.Context, mode types.BackwardMode, dOut *tensor.TensorNumeric[T], ...) ([]*tensor.TensorNumeric[T], error)
- func (a *Add[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (a *Add[T]) OpType() string
- func (a *Add[T]) OutputShape() []int
- func (a *Add[T]) Parameters() []*graph.Parameter[T]
- type Bias
- func NewBias[T tensor.Numeric](name string, engine compute.Engine[T], ops numeric.Arithmetic[T], size int, ...) (*Bias[T], error)
- func NewBiasFromParam[T tensor.Numeric](engine compute.Engine[T], ops numeric.Arithmetic[T], ...) *Bias[T]
- func NewBiasWithFactories[T tensor.Numeric](name string, engine compute.Engine[T], ops numeric.Arithmetic[T], size int, ...) (*Bias[T], error)
- func (b *Bias[T]) Attributes() map[string]interface{}
- func (b *Bias[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (b *Bias[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (b *Bias[T]) OpType() string
- func (b *Bias[T]) OutputShape() []int
- func (b *Bias[T]) Parameters() []*graph.Parameter[T]
- func (b *Bias[T]) SetName(name string)
- type BiasOption
- type BiasOptions
- type Cast
- func (c *Cast[T]) Attributes() map[string]interface{}
- func (c *Cast[T]) Backward(_ context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (c *Cast[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (c *Cast[T]) OpType() string
- func (c *Cast[T]) OutputShape() []int
- func (c *Cast[T]) Parameters() []*graph.Parameter[T]
- type Concat
- func (c *Concat[T]) Attributes() map[string]interface{}
- func (c *Concat[T]) Backward(_ context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (c *Concat[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (c *Concat[T]) OpType() string
- func (c *Concat[T]) OutputShape() []int
- func (c *Concat[T]) Parameters() []*graph.Parameter[T]
- type Dense
- func (d *Dense[T]) Attributes() map[string]interface{}
- func (d *Dense[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (d *Dense[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (d *Dense[T]) OpType() string
- func (d *Dense[T]) OutputShape() []int
- func (d *Dense[T]) Parameters() []*graph.Parameter[T]
- func (d *Dense[T]) SetName(name string)
- type DenseOption
- type DenseOptions
- type FFN
- func (f *FFN[T]) Attributes() map[string]interface{}
- func (f *FFN[T]) Backward(ctx context.Context, mode types.BackwardMode, dOut *tensor.TensorNumeric[T], ...) ([]*tensor.TensorNumeric[T], error)
- func (f *FFN[T]) Engine() compute.Engine[T]
- func (f *FFN[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (f *FFN[T]) OpType() string
- func (f *FFN[T]) OutputShape() []int
- func (f *FFN[T]) Parameters() []*graph.Parameter[T]
- type FFNOption
- type FFNOptions
- type FiLM
- func (f *FiLM[T]) Attributes() map[string]interface{}
- func (f *FiLM[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (f *FiLM[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (f *FiLM[T]) OpType() string
- func (f *FiLM[T]) OutputShape() []int
- func (f *FiLM[T]) Parameters() []*graph.Parameter[T]
- type LMHead
- func (h *LMHead[T]) Backward(ctx context.Context, mode types.BackwardMode, dOut *tensor.TensorNumeric[T], ...) ([]*tensor.TensorNumeric[T], error)
- func (h *LMHead[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (h *LMHead[T]) OutputShape() []int
- func (h *LMHead[T]) Parameters() []*graph.Parameter[T]
- func (h *LMHead[T]) SetWeights(weights *tensor.TensorNumeric[T])
- type Linear
- func NewLinear[T tensor.Numeric](name string, engine compute.Engine[T], ops numeric.Arithmetic[T], ...) (*Linear[T], error)
- func NewLinearFromParam[T tensor.Numeric](engine compute.Engine[T], weights *graph.Parameter[T]) *Linear[T]
- func NewLinearWithFactories[T tensor.Numeric](name string, engine compute.Engine[T], _ numeric.Arithmetic[T], ...) (*Linear[T], error)
- func (l *Linear[T]) Attributes() map[string]interface{}
- func (l *Linear[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (l *Linear[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (l *Linear[T]) OpType() string
- func (l *Linear[T]) OutputShape() []int
- func (l *Linear[T]) Parameters() []*graph.Parameter[T]
- func (l *Linear[T]) SetName(name string)
- type LinearOption
- func WithHe[T tensor.Numeric](ops numeric.Arithmetic[T]) LinearOption[T]
- func WithInitializer[T tensor.Numeric](initializer components.WeightInitializer[T]) LinearOption[T]
- func WithUniform[T tensor.Numeric](ops numeric.Arithmetic[T], scale float64) LinearOption[T]
- func WithXavier[T tensor.Numeric](ops numeric.Arithmetic[T]) LinearOption[T]
- type LinearOptions
- type MatMul
- func (m *MatMul[T]) Attributes() map[string]interface{}
- func (m *MatMul[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (m *MatMul[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (m *MatMul[T]) OpType() string
- func (m *MatMul[T]) OutputShape() []int
- func (m *MatMul[T]) Parameters() []*graph.Parameter[T]
- type Mul
- func (m *Mul[T]) Attributes() map[string]interface{}
- func (m *Mul[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (m *Mul[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (m *Mul[T]) OpType() string
- func (m *Mul[T]) OutputShape() []int
- func (m *Mul[T]) Parameters() []*graph.Parameter[T]
- type PolynomialExpansion
- func (p *PolynomialExpansion[T]) Attributes() map[string]interface{}
- func (p *PolynomialExpansion[T]) Backward(_ context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (p *PolynomialExpansion[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (p *PolynomialExpansion[T]) GetDegree() int
- func (p *PolynomialExpansion[T]) GetInputSize() int
- func (p *PolynomialExpansion[T]) GetOutputSize() int
- func (p *PolynomialExpansion[T]) GetTermIndices() [][]int
- func (p *PolynomialExpansion[T]) HasBias() bool
- func (p *PolynomialExpansion[T]) OpType() string
- func (p *PolynomialExpansion[T]) OutputShape() []int
- func (p *PolynomialExpansion[T]) Parameters() []*graph.Parameter[T]
- func (p *PolynomialExpansion[T]) SetName(_ string)
- type PolynomialExpansionOption
- type PolynomialExpansionOptions
- type Reshape
- func (r *Reshape[T]) Attributes() map[string]interface{}
- func (r *Reshape[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (r *Reshape[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (r *Reshape[T]) OpType() string
- func (r *Reshape[T]) OutputShape() []int
- func (r *Reshape[T]) Parameters() []*graph.Parameter[T]
- type RotaryEmbedding
- func (r *RotaryEmbedding[T]) Attributes() map[string]interface{}
- func (r *RotaryEmbedding[T]) Backward(_ context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (r *RotaryEmbedding[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (r *RotaryEmbedding[T]) Name() string
- func (r *RotaryEmbedding[T]) OpType() string
- func (r *RotaryEmbedding[T]) OutputShape() []int
- func (r *RotaryEmbedding[T]) Parameters() []*graph.Parameter[T]
- func (r *RotaryEmbedding[T]) SetName(name string)
- type Shape
- func (s *Shape[T]) Attributes() map[string]interface{}
- func (s *Shape[T]) Backward(_ context.Context, mode types.BackwardMode, _ *tensor.TensorNumeric[T], ...) ([]*tensor.TensorNumeric[T], error)
- func (s *Shape[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (s *Shape[T]) OpType() string
- func (s *Shape[T]) OutputShape() []int
- func (s *Shape[T]) Parameters() []*graph.Parameter[T]
- type SpectralFingerprint
- func (s *SpectralFingerprint[T]) Attributes() map[string]interface{}
- func (s *SpectralFingerprint[T]) Backward(_ context.Context, mode types.BackwardMode, _ *tensor.TensorNumeric[T], ...) ([]*tensor.TensorNumeric[T], error)
- func (s *SpectralFingerprint[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (s *SpectralFingerprint[T]) OpType() string
- func (s *SpectralFingerprint[T]) OutputShape() []int
- func (s *SpectralFingerprint[T]) Parameters() []*graph.Parameter[T]
- type Sub
- func (s *Sub[T]) Attributes() map[string]interface{}
- func (s *Sub[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (s *Sub[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (s *Sub[T]) OpType() string
- func (s *Sub[T]) OutputShape() []int
- func (s *Sub[T]) Parameters() []*graph.Parameter[T]
- type Unsqueeze
- func (u *Unsqueeze[T]) Attributes() map[string]interface{}
- func (u *Unsqueeze[T]) Backward(ctx context.Context, mode types.BackwardMode, ...) ([]*tensor.TensorNumeric[T], error)
- func (u *Unsqueeze[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
- func (u *Unsqueeze[T]) OpType() string
- func (u *Unsqueeze[T]) OutputShape() []int
- func (u *Unsqueeze[T]) Parameters() []*graph.Parameter[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCast ¶ added in v0.3.0
func BuildCast[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], _ map[string]interface{}, ) (graph.Node[T], error)
BuildCast constructs a Cast node.
func BuildConcat ¶ added in v0.3.0
func BuildConcat[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], attributes map[string]interface{}, ) (graph.Node[T], error)
BuildConcat constructs a Concat node, extracting the axis from attributes.
func BuildMatMul ¶ added in v0.3.0
func BuildMatMul[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], _ map[string]interface{}, ) (graph.Node[T], error)
BuildMatMul constructs a new MatMul node for the given compute engine. It conforms to the layer registry builder signature used by the graph builder.
func BuildMul ¶ added in v0.3.0
func BuildMul[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], _ map[string]interface{}, ) (graph.Node[T], error)
BuildMul constructs a new Mul node for the given compute engine. It conforms to the layer registry builder signature used by the graph builder.
func BuildReshape ¶ added in v0.3.0
func BuildReshape[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], attributes map[string]interface{}, ) (graph.Node[T], error)
BuildReshape constructs a Reshape node, parsing target shape from attributes.
func BuildRotaryEmbedding ¶ added in v0.3.0
func BuildRotaryEmbedding[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], name string, _ map[string]*graph.Parameter[T], attributes map[string]interface{}, ) (graph.Node[T], error)
BuildRotaryEmbedding constructs a new RotaryPositionalEmbedding node for the given compute engine. It conforms to the layer registry builder signature used by the graph builder.
func BuildShape ¶ added in v0.3.0
func BuildShape[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], _ map[string]interface{}, ) (graph.Node[T], error)
BuildShape constructs a new Shape node for the given compute engine. It conforms to the layer registry builder signature used by the graph builder.
func BuildSpectralFingerprint ¶ added in v0.3.0
func BuildSpectralFingerprint[T tensor.Numeric]( engine compute.Engine[T], ops numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], attributes map[string]interface{}, ) (graph.Node[T], error)
BuildSpectralFingerprint constructs a SpectralFingerprint node from attributes. Required attributes: - "window" (int): window length to analyze (must be > 1) - "top_k" (int): number of non-DC bins to output (must be > 0).
func BuildSub ¶ added in v0.3.0
func BuildSub[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], _ map[string]interface{}, ) (graph.Node[T], error)
BuildSub constructs a new Sub node for the given compute engine. It conforms to the layer registry builder signature used by the graph builder.
func BuildUnsqueeze ¶ added in v0.3.0
func BuildUnsqueeze[T tensor.Numeric]( engine compute.Engine[T], _ numeric.Arithmetic[T], _ string, _ map[string]*graph.Parameter[T], attributes map[string]interface{}, ) (graph.Node[T], error)
BuildUnsqueeze constructs a new Unsqueeze node for the given compute engine. It parses optional "axes" attributes from the attributes map.
Types ¶
type Add ¶ added in v0.3.0
Add represents an element-wise addition node.
func (*Add[T]) Attributes ¶ added in v0.3.0
Attributes returns the attributes of the Add node.
func (*Add[T]) Backward ¶ added in v0.3.0
func (a *Add[T]) Backward(_ context.Context, mode types.BackwardMode, dOut *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the backward pass of the Add node.
func (*Add[T]) Forward ¶ added in v0.3.0
func (a *Add[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the forward pass of the Add node.
func (*Add[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Add node.
func (*Add[T]) Parameters ¶ added in v0.3.0
Parameters returns the parameters of the Add node.
type Bias ¶
Bias adds a bias vector to its input.
func NewBias ¶
func NewBias[T tensor.Numeric](name string, engine compute.Engine[T], ops numeric.Arithmetic[T], size int, opts ...BiasOption[T]) (*Bias[T], error)
NewBias creates a new Bias layer with default tensor and parameter creation.
func NewBiasFromParam ¶ added in v0.3.0
func NewBiasFromParam[T tensor.Numeric](engine compute.Engine[T], ops numeric.Arithmetic[T], biases *graph.Parameter[T]) *Bias[T]
NewBiasFromParam creates a new Bias layer from an existing biases parameter.
func NewBiasWithFactories ¶
func NewBiasWithFactories[T tensor.Numeric]( name string, engine compute.Engine[T], ops numeric.Arithmetic[T], size int, newTensor func([]int, []T) (*tensor.TensorNumeric[T], error), newParameter func(string, *tensor.TensorNumeric[T], func([]int, []T) (*tensor.TensorNumeric[T], error)) (*graph.Parameter[T], error), initializer func(size int) []T, ) (*Bias[T], error)
NewBiasWithFactories creates a new Bias layer with custom tensor and parameter creation functions.
func (*Bias[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the Bias layer.
func (*Bias[T]) Backward ¶
func (b *Bias[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients.
func (*Bias[T]) Forward ¶
func (b *Bias[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward performs the forward pass: output = input + biases.
func (*Bias[T]) OutputShape ¶
OutputShape returns the output shape of the Bias layer.
func (*Bias[T]) Parameters ¶
Parameters returns the parameters of the Bias layer.
type BiasOption ¶ added in v0.3.0
type BiasOption[T tensor.Numeric] func(*BiasOptions[T])
BiasOption is a function that applies an option to BiasOptions.
func WithBiasInitializer ¶ added in v0.3.0
func WithBiasInitializer[T tensor.Numeric](initializer func(size int) []T) BiasOption[T]
WithBiasInitializer sets a custom initializer for the bias vector.
type BiasOptions ¶ added in v0.3.0
BiasOptions holds configuration options for the Bias layer.
type Cast ¶ added in v0.3.0
Cast is a layer that converts tensor elements to a different data type.
func (*Cast[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the Cast layer.
func (*Cast[T]) Backward ¶ added in v0.3.0
func (c *Cast[T]) Backward(_ context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Cast layer.
func (*Cast[T]) Forward ¶ added in v0.3.0
func (c *Cast[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the cast operation (for same type, this is essentially a copy).
func (*Cast[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Cast layer.
func (*Cast[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Cast layer.
type Concat ¶ added in v0.3.0
Concat is a layer that concatenates multiple tensors along a specified axis.
func (*Concat[T]) Attributes ¶ added in v0.3.0
Attributes returns the attributes of the Concat layer.
func (*Concat[T]) Backward ¶ added in v0.3.0
func (c *Concat[T]) Backward(_ context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Concat layer.
func (*Concat[T]) Forward ¶ added in v0.3.0
func (c *Concat[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the concatenation of input tensors along the specified axis.
func (*Concat[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Concat layer.
func (*Concat[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Concat layer.
type Dense ¶
Dense is a fully connected layer that combines a linear transformation and a bias.
func NewDense ¶
func NewDense[T tensor.Numeric]( name string, engine compute.Engine[T], ops numeric.Arithmetic[T], inputSize, outputSize int, opts ...DenseOption[T], ) (*Dense[T], error)
NewDense creates a new Dense layer.
func NewDenseFromParams ¶ added in v0.3.0
NewDenseFromParams creates a new Dense layer from existing parameters.
func (*Dense[T]) Attributes ¶ added in v0.3.0
Attributes returns the attributes of the Dense layer.
func (*Dense[T]) Backward ¶
func (d *Dense[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients.
func (*Dense[T]) Forward ¶
func (d *Dense[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward performs the forward pass: output = input*weights + biases.
func (*Dense[T]) OutputShape ¶
OutputShape returns the output shape of the Dense layer.
func (*Dense[T]) Parameters ¶
Parameters returns the parameters of the Dense layer.
type DenseOption ¶ added in v0.3.0
type DenseOption[T tensor.Numeric] func(*DenseOptions[T])
DenseOption is a function that applies an option to DenseOptions.
type DenseOptions ¶ added in v0.3.0
DenseOptions holds configuration options for the Dense layer.
type FFN ¶ added in v0.3.0
FFN (Feed-Forward Network) implements a two-layer MLP with SwiGLU activation.
func NewFFN ¶ added in v0.3.0
func NewFFN[T tensor.Numeric](name string, engine compute.Engine[T], ops numeric.Arithmetic[T], inputDim, hiddenDim, outputDim int, opts ...FFNOption[T]) (*FFN[T], error)
NewFFN creates a new Feed-Forward Network layer. name: The name of the FFN layer. engine: The compute engine to use for tensor operations. ops: Numeric operations for the given type T. inputDim: The input dimension of the FFN. hiddenDim: The dimension of the hidden layer. outputDim: The output dimension of the FFN.
func (*FFN[T]) Attributes ¶ added in v0.3.0
Attributes returns the attributes.
func (*FFN[T]) Backward ¶ added in v0.3.0
func (f *FFN[T]) Backward(ctx context.Context, mode types.BackwardMode, dOut *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the backward pass of the FFN.
func (*FFN[T]) Forward ¶ added in v0.3.0
func (f *FFN[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the forward pass of the FFN.
func (*FFN[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the FFN layer.
func (*FFN[T]) Parameters ¶ added in v0.3.0
Parameters returns the trainable parameters of the FFN layer.
type FFNOption ¶ added in v0.3.0
type FFNOption[T tensor.Numeric] func(*FFNOptions[T])
FFNOption is a function that applies an option to FFNOptions.
func WithFFNBias ¶ added in v0.3.0
WithFFNBias sets whether the FFN layer should include bias terms.
func WithFFNInitializer ¶ added in v0.3.0
func WithFFNInitializer[T tensor.Numeric](initializer components.WeightInitializer[T]) FFNOption[T]
WithFFNInitializer sets a custom weight initializer for the FFN layer.
type FFNOptions ¶ added in v0.3.0
type FFNOptions[T tensor.Numeric] struct { Initializer components.WeightInitializer[T] WithBias bool }
FFNOptions holds configuration options for the FFN layer.
type FiLM ¶ added in v0.3.0
FiLM (Feature-wise Linear Modulation) layer. It takes a feature tensor and a context tensor as input. It generates scale and bias vectors from the context tensor and applies them to the feature tensor. Output = (feature * scale) + bias
func NewFiLM ¶ added in v0.3.0
func NewFiLM[T tensor.Numeric]( name string, engine compute.Engine[T], ops numeric.Arithmetic[T], contextDim, featureDim int, ) (*FiLM[T], error)
NewFiLM creates a new FiLM layer.
func (*FiLM[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the FiLM layer.
func (*FiLM[T]) Backward ¶ added in v0.3.0
func (f *FiLM[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the FiLM layer.
func (*FiLM[T]) Forward ¶ added in v0.3.0
func (f *FiLM[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward performs the forward pass for the FiLM layer. It expects two inputs: inputs[0] is the feature tensor, inputs[1] is the context tensor.
func (*FiLM[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the FiLM layer.
func (*FiLM[T]) Parameters ¶ added in v0.3.0
Parameters returns the parameters of the FiLM layer.
type LMHead ¶ added in v0.3.0
LMHead is a linear layer that maps hidden states to vocabulary logits.
func NewLMHead ¶ added in v0.3.0
func NewLMHead[T tensor.Numeric](engine compute.Engine[T], ops numeric.Arithmetic[T], hiddenDim, vocabSize int) (*LMHead[T], error)
NewLMHead creates a new LMHead.
func (*LMHead[T]) Backward ¶ added in v0.3.0
func (h *LMHead[T]) Backward(ctx context.Context, mode types.BackwardMode, dOut *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the backward pass of the LMHead.
func (*LMHead[T]) Forward ¶ added in v0.3.0
func (h *LMHead[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the forward pass of the LMHead.
func (*LMHead[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the LMHead.
func (*LMHead[T]) Parameters ¶ added in v0.3.0
Parameters returns the parameters of the LMHead.
func (*LMHead[T]) SetWeights ¶ added in v0.3.0
func (h *LMHead[T]) SetWeights(weights *tensor.TensorNumeric[T])
SetWeights sets the weights of the LMHead. This is useful for sharing weights with a token embedding layer.
type Linear ¶
Linear performs a linear transformation: output = input * weights. Uses component-based architecture for better modularity and testability.
func NewLinear ¶
func NewLinear[T tensor.Numeric]( name string, engine compute.Engine[T], ops numeric.Arithmetic[T], inputSize, outputSize int, opts ...LinearOption[T], ) (*Linear[T], error)
NewLinear creates a new Linear layer.
func NewLinearFromParam ¶ added in v0.3.0
func NewLinearFromParam[T tensor.Numeric](engine compute.Engine[T], weights *graph.Parameter[T]) *Linear[T]
NewLinearFromParam creates a new Linear layer from an existing weights parameter.
func NewLinearWithFactories ¶
func NewLinearWithFactories[T tensor.Numeric]( name string, engine compute.Engine[T], _ numeric.Arithmetic[T], inputSize, outputSize int, initializer components.WeightInitializer[T], newTensor func([]int, []T) (*tensor.TensorNumeric[T], error), newParameter func(string, *tensor.TensorNumeric[T], func([]int, []T) (*tensor.TensorNumeric[T], error)) (*graph.Parameter[T], error), ) (*Linear[T], error)
NewLinearWithFactories creates a new Linear layer with custom tensor and parameter creation functions.
func (*Linear[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the Linear layer.
func (*Linear[T]) Backward ¶
func (l *Linear[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients using the gradient computer component.
func (*Linear[T]) Forward ¶
func (l *Linear[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward performs the forward pass: output = input * weights.
func (*Linear[T]) OutputShape ¶
OutputShape returns the output shape of the Linear layer.
func (*Linear[T]) Parameters ¶
Parameters returns the parameters of the Linear layer.
type LinearOption ¶ added in v0.3.0
type LinearOption[T tensor.Numeric] func(*LinearOptions[T])
LinearOption is a function that applies an option to LinearOptions.
func WithHe ¶ added in v0.3.0
func WithHe[T tensor.Numeric](ops numeric.Arithmetic[T]) LinearOption[T]
WithHe is an option to use He weight initialization.
func WithInitializer ¶ added in v0.3.0
func WithInitializer[T tensor.Numeric](initializer components.WeightInitializer[T]) LinearOption[T]
WithInitializer sets a custom weight initializer for the Linear layer.
func WithUniform ¶ added in v0.3.0
func WithUniform[T tensor.Numeric](ops numeric.Arithmetic[T], scale float64) LinearOption[T]
WithUniform is an option to use Uniform weight initialization.
func WithXavier ¶ added in v0.3.0
func WithXavier[T tensor.Numeric](ops numeric.Arithmetic[T]) LinearOption[T]
WithXavier is an option to use Xavier weight initialization.
type LinearOptions ¶ added in v0.3.0
type LinearOptions[T tensor.Numeric] struct { Initializer components.WeightInitializer[T] }
LinearOptions holds configuration options for the Linear layer.
type MatMul ¶ added in v0.3.0
MatMul is a layer that performs matrix multiplication of two tensors.
func (*MatMul[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the MatMul layer.
func (*MatMul[T]) Backward ¶ added in v0.3.0
func (m *MatMul[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the MatMul layer.
func (*MatMul[T]) Forward ¶ added in v0.3.0
func (m *MatMul[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the matrix multiplication.
func (*MatMul[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the MatMul layer.
func (*MatMul[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the MatMul layer.
type Mul ¶ added in v0.3.0
Mul is a layer that performs element-wise multiplication of two tensors.
func (*Mul[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the Mul layer.
func (*Mul[T]) Backward ¶ added in v0.3.0
func (m *Mul[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Mul layer.
func (*Mul[T]) Forward ¶ added in v0.3.0
func (m *Mul[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the element-wise multiplication of two input tensors.
func (*Mul[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Mul layer.
func (*Mul[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Mul layer.
type PolynomialExpansion ¶
PolynomialExpansion layer transforms input features into polynomial combinations up to a specified degree. This is useful for capturing non-linear relationships in data through feature engineering.
For input [x1, x2] with degree 2, it generates: [1, x1, x2, x1^2, x1*x2, x2^2]
The layer supports: - Configurable polynomial degree - Optional bias term (constant 1) - Interaction terms between features - Efficient computation using tensor operations.
func NewPolynomialExpansion ¶
func NewPolynomialExpansion[T tensor.Numeric]( name string, engine compute.Engine[T], ops numeric.Arithmetic[T], inputSize int, options ...PolynomialExpansionOption[T], ) (*PolynomialExpansion[T], error)
NewPolynomialExpansion creates a new polynomial expansion layer.
Parameters: - name: layer name (currently not used but kept for consistency) - engine: compute engine for tensor operations - ops: arithmetic operations for the numeric type - inputSize: number of input features - options: functional options for configuration
Default values: - degree: 2 - includeBias: true
Returns the polynomial expansion layer or an error if parameters are invalid.
func (*PolynomialExpansion[T]) Attributes ¶ added in v0.3.0
func (p *PolynomialExpansion[T]) Attributes() map[string]interface{}
Attributes returns the attributes of the PolynomialExpansion layer.
func (*PolynomialExpansion[T]) Backward ¶
func (p *PolynomialExpansion[T]) Backward(_ context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes gradients for the polynomial expansion layer. This computes the derivative of each polynomial term with respect to the input features.
func (*PolynomialExpansion[T]) Forward ¶
func (p *PolynomialExpansion[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward performs the polynomial expansion transformation. Input shape: [batch_size, input_size] Output shape: [batch_size, output_size].
func (*PolynomialExpansion[T]) GetDegree ¶
func (p *PolynomialExpansion[T]) GetDegree() int
GetDegree returns the polynomial degree of the layer.
func (*PolynomialExpansion[T]) GetInputSize ¶
func (p *PolynomialExpansion[T]) GetInputSize() int
GetInputSize returns the input size of the layer.
func (*PolynomialExpansion[T]) GetOutputSize ¶
func (p *PolynomialExpansion[T]) GetOutputSize() int
GetOutputSize returns the output size of the layer.
func (*PolynomialExpansion[T]) GetTermIndices ¶
func (p *PolynomialExpansion[T]) GetTermIndices() [][]int
GetTermIndices returns the polynomial term indices for inspection/debugging.
func (*PolynomialExpansion[T]) HasBias ¶
func (p *PolynomialExpansion[T]) HasBias() bool
HasBias returns whether the layer includes a bias term.
func (*PolynomialExpansion[T]) OpType ¶ added in v0.3.0
func (p *PolynomialExpansion[T]) OpType() string
OpType returns the operation type of the PolynomialExpansion layer.
func (*PolynomialExpansion[T]) OutputShape ¶
func (p *PolynomialExpansion[T]) OutputShape() []int
OutputShape returns the shape of the output tensor.
func (*PolynomialExpansion[T]) Parameters ¶
func (p *PolynomialExpansion[T]) Parameters() []*graph.Parameter[T]
Parameters returns the parameters of the layer. Polynomial expansion has no trainable parameters.
func (*PolynomialExpansion[T]) SetName ¶
func (p *PolynomialExpansion[T]) SetName(_ string)
SetName sets the name of the layer (for consistency with other layers). SetName sets the name of the layer (for consistency with other layers).
type PolynomialExpansionOption ¶ added in v0.3.0
type PolynomialExpansionOption[T tensor.Numeric] func(*PolynomialExpansionOptions[T])
PolynomialExpansionOption is a function that configures PolynomialExpansionOptions.
func WithPolynomialBias ¶ added in v0.3.0
func WithPolynomialBias[T tensor.Numeric](includeBias bool) PolynomialExpansionOption[T]
WithPolynomialBias sets whether to include a bias term (constant 1).
func WithPolynomialDegree ¶ added in v0.3.0
func WithPolynomialDegree[T tensor.Numeric](degree int) PolynomialExpansionOption[T]
WithPolynomialDegree sets the maximum polynomial degree.
type PolynomialExpansionOptions ¶ added in v0.3.0
PolynomialExpansionOptions holds configuration options for PolynomialExpansion layer.
type Reshape ¶ added in v0.3.0
Reshape is a layer that changes the shape of a tensor without changing its data.
func NewReshape ¶ added in v0.3.0
NewReshape creates a new Reshape layer.
func (*Reshape[T]) Attributes ¶ added in v0.3.0
Attributes returns the attributes of the Reshape layer.
func (*Reshape[T]) Backward ¶ added in v0.3.0
func (r *Reshape[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Reshape layer.
func (*Reshape[T]) Forward ¶ added in v0.3.0
func (r *Reshape[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the reshape operation.
func (*Reshape[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Reshape layer.
func (*Reshape[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Reshape layer.
type RotaryEmbedding ¶ added in v0.3.0
RotaryEmbedding applies rotary position embedding to input tensors.
func NewRotaryEmbedding ¶ added in v0.3.0
func NewRotaryEmbedding[T tensor.Numeric](engine compute.Engine[T]) *RotaryEmbedding[T]
NewRotaryEmbedding creates a new RotaryEmbedding layer.
func (*RotaryEmbedding[T]) Attributes ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) Attributes() map[string]interface{}
Attributes returns nil for the RotaryEmbedding layer.
func (*RotaryEmbedding[T]) Backward ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) Backward(_ context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the RotaryEmbedding layer.
func (*RotaryEmbedding[T]) Forward ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward applies rotary embedding to the input.
func (*RotaryEmbedding[T]) Name ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) Name() string
Name returns the name of the layer.
func (*RotaryEmbedding[T]) OpType ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) OpType() string
OpType returns the operation type of the RotaryEmbedding layer.
func (*RotaryEmbedding[T]) OutputShape ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) OutputShape() []int
OutputShape returns the output shape of the layer.
func (*RotaryEmbedding[T]) Parameters ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) Parameters() []*graph.Parameter[T]
Parameters returns the parameters of the layer (none for RotaryEmbedding).
func (*RotaryEmbedding[T]) SetName ¶ added in v0.3.0
func (r *RotaryEmbedding[T]) SetName(name string)
SetName sets the name of the layer.
type Shape ¶ added in v0.3.0
Shape is a layer that outputs the shape of its input tensor.
func (*Shape[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the Shape layer.
func (*Shape[T]) Backward ¶ added in v0.3.0
func (s *Shape[T]) Backward(_ context.Context, mode types.BackwardMode, _ *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Shape layer.
func (*Shape[T]) Forward ¶ added in v0.3.0
func (s *Shape[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the shape of the input tensor.
func (*Shape[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Shape layer.
func (*Shape[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Shape layer.
type SpectralFingerprint ¶ added in v0.3.0
SpectralFingerprint implements a layer that extracts the top-K frequency components from the input using FFT, creating a fixed-size spectral signature for variable-length inputs.
func NewSpectralFingerprint ¶ added in v0.3.0
func NewSpectralFingerprint[T tensor.Numeric](engine compute.Engine[T], ops numeric.Arithmetic[T], window, topK int) (*SpectralFingerprint[T], error)
NewSpectralFingerprint creates a new SpectralFingerprint layer.
func (*SpectralFingerprint[T]) Attributes ¶ added in v0.3.0
func (s *SpectralFingerprint[T]) Attributes() map[string]interface{}
Attributes returns the attributes of the layer.
func (*SpectralFingerprint[T]) Backward ¶ added in v0.3.0
func (s *SpectralFingerprint[T]) Backward(_ context.Context, mode types.BackwardMode, _ *tensor.TensorNumeric[T], _ ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward returns no gradients (treated as non-differentiable feature transform).
func (*SpectralFingerprint[T]) Forward ¶ added in v0.3.0
func (s *SpectralFingerprint[T]) Forward(_ context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes spectral magnitudes for bins 1..topK for each row in the batch. Input must be [batch, window]. If input window dimension is larger than the configured window, only the last `window` elements are used. If smaller, an error is returned.
func (*SpectralFingerprint[T]) OpType ¶ added in v0.3.0
func (s *SpectralFingerprint[T]) OpType() string
OpType returns the operation type.
func (*SpectralFingerprint[T]) OutputShape ¶ added in v0.3.0
func (s *SpectralFingerprint[T]) OutputShape() []int
OutputShape returns the last computed output shape.
func (*SpectralFingerprint[T]) Parameters ¶ added in v0.3.0
func (s *SpectralFingerprint[T]) Parameters() []*graph.Parameter[T]
Parameters returns no trainable parameters for SpectralFingerprint.
type Sub ¶ added in v0.3.0
Sub is a layer that performs element-wise subtraction of two tensors.
func (*Sub[T]) Attributes ¶ added in v0.3.0
Attributes returns nil for the Sub layer.
func (*Sub[T]) Backward ¶ added in v0.3.0
func (s *Sub[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Sub layer.
func (*Sub[T]) Forward ¶ added in v0.3.0
func (s *Sub[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the element-wise subtraction of two input tensors (a - b).
func (*Sub[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Sub layer.
func (*Sub[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Sub layer.
type Unsqueeze ¶ added in v0.3.0
Unsqueeze is a layer that adds dimensions of size 1 to a tensor at specified axes.
func NewUnsqueeze ¶ added in v0.3.0
NewUnsqueeze creates a new Unsqueeze layer.
func (*Unsqueeze[T]) Attributes ¶ added in v0.3.0
Attributes returns the attributes of the Unsqueeze layer.
func (*Unsqueeze[T]) Backward ¶ added in v0.3.0
func (u *Unsqueeze[T]) Backward(ctx context.Context, mode types.BackwardMode, outputGradient *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
Backward computes the gradients for the Unsqueeze layer.
func (*Unsqueeze[T]) Forward ¶ added in v0.3.0
func (u *Unsqueeze[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)
Forward computes the unsqueeze operation by reshaping the input tensor.
func (*Unsqueeze[T]) OpType ¶ added in v0.3.0
OpType returns the operation type of the Unsqueeze layer.
func (*Unsqueeze[T]) OutputShape ¶ added in v0.3.0
OutputShape returns the output shape of the Unsqueeze layer.
func (*Unsqueeze[T]) Parameters ¶ added in v0.3.0
Parameters returns no trainable parameters for the Unsqueeze layer.
Source Files
¶
- add.go
- bias.go
- cast.go
- cast_registry.go
- concat.go
- concat_registry.go
- dense.go
- ffn.go
- film.go
- linear.go
- lm_head.go
- matmul.go
- matmul_registry.go
- mul.go
- mul_registry.go
- polynomial.go
- registry.go
- reshape.go
- reshape_registry.go
- rotary_embedding.go
- rotary_embedding_registry.go
- shape.go
- shape_registry.go
- spectral_fingerprint.go
- spectral_fingerprint_registry.go
- sub.go
- sub_registry.go
- unsqueeze.go
- unsqueeze_registry.go