feat: initial release
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package signal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"sourcedock.dev/petrbalvin/tensor/internal/core"
|
||||
)
|
||||
|
||||
func ExampleConv2D() {
|
||||
x, _ := core.FromFloats([]float64{
|
||||
1, 2, 3, 4,
|
||||
5, 6, 7, 8,
|
||||
}, 1, 1, 2, 4)
|
||||
w, _ := core.FromFloats([]float64{1, 0, 0, 1}, 1, 1, 2, 2)
|
||||
out, err := Conv2D(x, w, nil, 1, 0)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(out)
|
||||
// Output: float (1, 1, 1, 3) [7, 9, 11]
|
||||
}
|
||||
|
||||
func ExampleFFT() {
|
||||
x, _ := core.FromFloats([]float64{1, 1, 1, 1}, 4)
|
||||
spec, err := FFT(x)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
dc, _ := core.ComplexAt(spec, 0)
|
||||
fmt.Println(real(dc))
|
||||
// Output: 4
|
||||
}
|
||||
Reference in New Issue
Block a user