We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
my code like this:
package main import ( "fmt" . "gorgonia.org/gorgonia" "gorgonia.org/tensor" ) var w = tensor.New(tensor.WithShape(2, 2), tensor.WithBacking(GlorotEtAlN32(1, 2, 2))) var xs = tensor.New(tensor.WithShape(2, 2), tensor.WithBacking([]float32{1, 2, 3, 4})) var ys = tensor.New(tensor.WithShape(2, 2), tensor.WithBacking([]float32{5, 6, 7, 8})) func assert(err error) { if err != nil { panic(err) } } func worker(ch chan struct{}) { g := NewGraph() x := NewMatrix(g, tensor.Float32, WithShape(2, 2), WithName("x")) y := NewMatrix(g, tensor.Float32, WithShape(2, 2), WithName("y")) wx := NodeFromAny(g, w, WithName("w")) pred := Must(Mul(x, wx)) // mse diff := Must(Sub(y, pred)) sqDiff := Must(Square(diff)) loss := Must(Mean(sqDiff)) _, err := Grad(loss, wx) assert(err) // vm vm := NewTapeMachine(g, BindDualValues(wx)) defer vm.Close() for { <-ch Let(x, xs) Let(y, ys) assert(vm.RunAll()) // panic on this more than 10 times vm.Reset() } } func main() { ch := make(chan struct{}) for i := 0; i < 2; i++ { go worker(ch) } for i := 0; i < 10000; i++ { ch <- struct{}{} } fmt.Println(w) }
when i run in 1 goroutine, it works, but panic on parallel:
panic: PC 31. Failed to execute instruction Aᵀ × B [CPU0 CPU4] CPU20 true false true: Happened while attempting to execute Aᵀ × B [CPU0 CPU4]CPU20 true false true. Node is 18. Register was: 20 : linAlgBinOp () × (2, 2) error: MatMul requires both operands to be matrices. Got t's shape: (), other's shape: (2, 2) goroutine 6 [running]: main.assert(...) /home/lwch/src/tnn/test/main.go:17 main.worker(0x0?) /home/lwch/src/tnn/test/main.go:40 +0x3d7 created by main.main /home/lwch/src/tnn/test/main.go:48 +0x34 exit status 2
how can i run in parallel and share the same weights
The text was updated successfully, but these errors were encountered:
oh okay.. this usecase is not one that I've seen before. Let me try
Sorry, something went wrong.
No branches or pull requests
my code like this:
when i run in 1 goroutine, it works, but panic on parallel:
how can i run in parallel and share the same weights
The text was updated successfully, but these errors were encountered: