Documentation
¶
Index ¶
- type SpectralFingerprint
- func (s *SpectralFingerprint[T]) Attributes() map[string]interface{}
- func (s *SpectralFingerprint[T]) Backward(_ context.Context, _ types.BackwardMode, _ *tensor.TensorNumeric[T], ...) ([]*tensor.TensorNumeric[T], error)
- func (s *SpectralFingerprint[T]) Forward(ctx 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]
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 ¶
func (s *SpectralFingerprint[T]) Backward(_ context.Context, _ types.BackwardMode, _ *tensor.TensorNumeric[T], inputs ...*tensor.TensorNumeric[T]) ([]*tensor.TensorNumeric[T], error)
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.