Last active
December 23, 2017 13:22
-
-
Save owulveryck/5f6c2876d2d142b3bdbdf9de73d93bf4 to your computer and use it in GitHub Desktop.
Panic with gorgonia, but why ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"testing" | |
G "gorgonia.org/gorgonia" | |
"gorgonia.org/tensor" | |
) | |
func TestMul(t *testing.T) { | |
g := G.NewGraph() | |
vecT := tensor.New(tensor.WithBacking([]float32{1, 1}), tensor.WithShape(2)) | |
vec := G.NewVector(g, tensor.Float32, G.WithName("x"), G.WithShape(2), G.WithValue(vecT)) | |
matT := tensor.New(tensor.WithBacking([]float32{0.95, 0.8}), tensor.WithShape(1, 2)) | |
mat := G.NewMatrix(g, tensor.Float32, G.WithName("W"), G.WithShape(1, 2), G.WithValue(matT)) | |
z, err := G.Mul(mat, vec) | |
if err != nil { | |
t.Fatal(err) | |
} | |
// create a VM to run the program on | |
machine := G.NewLispMachine(g, G.ExecuteFwdOnly()) | |
if err = machine.RunAll(); err != nil { | |
t.Fatal(err) | |
} | |
if z.Value().Data() != 0.95+0.8 { | |
t.Fatal("Expectecd %v, got %v", 0.95+0.8, z.Value().Data()) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
panic: blas: index of a out of range | |
goroutine 18 [running]: | |
gonum.org/v1/gonum/blas/gonum.Implementation.Sgemv(0x6f, 0x1, 0x2, 0x3f800000, 0xc42015e130, 0x2, 0x2, 0x1, 0xc42015e0a0, 0x2, ...) | |
/Users/olivierwulveryck/GOPROJECTS/src/gonum.org/v1/gonum/blas/gonum/level2single.go:33 +0x96f | |
gonum.org/v1/gonum/blas/gonum.(*Implementation).Sgemv(0x18c2b20, 0x6f, 0x1, 0x2, 0x3f800000, 0xc42015e130, 0x2, 0x2, 0x1, 0xc42015e0a0, ...) | |
<autogenerated>:1 +0x135 | |
gorgonia.org/tensor.StdEng.MatVecMul(0x18777e0, 0xc42017a0b0, 0x18777e0, 0xc42017a000, 0x18777e0, 0xc42017a2c0, 0xc42017a201, 0x1a733f8) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/tensor/defaultengine_linalg.go:422 +0x615 | |
gorgonia.org/tensor.(*StdEng).MatVecMul(0x18c2b20, 0x18777e0, 0xc42017a0b0, 0x18777e0, 0xc42017a000, 0x18777e0, 0xc42017a2c0, 0x0, 0xc42017a2c0) | |
<autogenerated>:1 +0x7b | |
gorgonia.org/tensor.(*Dense).MatVecMul(0xc42017a0b0, 0x18777e0, 0xc42017a000, 0x0, 0x0, 0x0, 0xc42017a2c0, 0x0, 0x0) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/tensor/dense_linalg.go:97 +0x463 | |
gorgonia.org/tensor.MatVecMul(0x18777e0, 0xc42017a0b0, 0x18777e0, 0xc42017a000, 0x0, 0x0, 0x0, 0xc42017a0b8, 0x2, 0xc420156f00, ...) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/tensor/api_arith.go:454 +0x2a0 | |
gorgonia.org/gorgonia.linAlgBinOp.do(0x1000001, 0xc420156fe0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/op_math.go:790 +0x2f3 | |
gorgonia.org/gorgonia.linAlgBinOp.Do(0x1000001, 0xc420156fe0, 0x2, 0x2, 0x100, 0x80, 0x7f, 0xc4200429c8) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/op_math.go:657 +0x7c | |
gorgonia.org/gorgonia.(*linAlgBinOp).Do(0xc42015e1d8, 0xc420156fe0, 0x2, 0x2, 0x199a868, 0x1537b40, 0xc4200429f0, 0x100e74e) | |
<autogenerated>:1 +0x71 | |
gorgonia.org/gorgonia.(*ExternalOp).Do(0xc42015a690, 0xc420156fe0, 0x2, 0x2, 0x2, 0x2, 0xc420042b70, 0xc420156fc0) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/execution.go:109 +0xa1 | |
gorgonia.org/gorgonia.dvBindVar(0x18746e0, 0xc42015a690, 0xc4201543b0, 0x2, 0x2, 0x0, 0x0, 0x0) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/dual.go:284 +0x75 | |
gorgonia.org/gorgonia.(*lispMachine).forward(0xc4201761e0, 0x0, 0x0) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/vm_genera.go:381 +0x1f8b | |
gorgonia.org/gorgonia.(*lispMachine).runall(0xc4201761e0, 0xc4201741e0, 0xc420174240) | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/vm_genera.go:255 +0x44 | |
created by gorgonia.org/gorgonia.(*lispMachine).RunAll | |
/Users/olivierwulveryck/GOPROJECTS/src/gorgonia.org/gorgonia/vm_genera.go:125 +0x1bb | |
exit status 2 | |
FAIL tmp/strides 0.015s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I change the LispMachine for a TapeMachine, it gives me: