features

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SpectralFingerprint

type SpectralFingerprint[T tensor.Numeric] struct {
	TopK int
	// contains filtered or unexported fields
}

SpectralFingerprint is a feature transformation layer that computes the DFT of a time-series input and returns the magnitudes of the top K frequencies. This layer is non-trainable and is typically used for feature extraction. Because it is non-trainable, it does not propagate gradients through this transformation (Backward returns nil), effectively treating it as a fixed feature extractor.

Computation uses engine primitives (MatMul, Mul, Add, Sqrt) with precomputed DFT basis matrices, making the layer fully traceable by the tracing compiler.

func NewSpectralFingerprint

func NewSpectralFingerprint[T tensor.Numeric](engine compute.Engine[T], ops numeric.Arithmetic[T], topK int) *SpectralFingerprint[T]

NewSpectralFingerprint creates a new SpectralFingerprint layer.

func (*SpectralFingerprint[T]) Attributes

func (s *SpectralFingerprint[T]) Attributes() map[string]interface{}

Attributes returns the attributes of the layer.

func (*SpectralFingerprint[T]) Backward

Backward for a non-trainable layer returns a nil gradient for the input.

func (*SpectralFingerprint[T]) Forward

func (s *SpectralFingerprint[T]) Forward(ctx context.Context, inputs ...*tensor.TensorNumeric[T]) (*tensor.TensorNumeric[T], error)

Forward computes the forward pass of the layer.

func (*SpectralFingerprint[T]) OpType

func (s *SpectralFingerprint[T]) OpType() string

OpType returns the operation type of the layer.

func (*SpectralFingerprint[T]) OutputShape

func (s *SpectralFingerprint[T]) OutputShape() []int

OutputShape returns the output shape of the layer.

func (*SpectralFingerprint[T]) Parameters

func (s *SpectralFingerprint[T]) Parameters() []*graph.Parameter[T]

Parameters returns no parameters as this layer is not trainable.

Jump to

Keyboard shortcuts

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