lstm icon indicating copy to clipboard operation
lstm copied to clipboard

Fix go get error for gorgonia 0.9.0beta

Open datastream opened this issue 5 years ago • 2 comments

go get github.com/owulveryck/lstm turn out error

github.com/owulveryck/lstm

src/github.com/owulveryck/lstm/train.go:124:24: cannot use gorgonia.Nodes literal (type gorgonia.Nodes) as type []gorgonia.ValueGrad in argument to solver.Step

https://github.com/owulveryck/lstm/blob/1581884e9d2de83e1150c04fb815637351082b7a/train.go#L124

diff --git a/train.go b/train.go
index b67f296..f8252aa 100644
--- a/train.go
+++ b/train.go
@@ -121,10 +121,10 @@ func (m *Model) Train(ctx context.Context, dset datasetter.FullTrainer, solver G
                                }
                                copy(hiddenT.Data().([]float32), hidden.Value().Data().([]float32))
                                copy(cellT.Data().([]float32), cell.Value().Data().([]float32))
-                               solver.Step(G.Nodes{
+                               solver.Step(G.NodesToValueGrads(G.Nodes{
                                        lstm.biasC, lstm.biasF, lstm.biasI, lstm.biasO, lstm.biasY,
                                        lstm.uc, lstm.uf, lstm.ui, lstm.uo,
-                                       lstm.wc, lstm.wf, lstm.wi, lstm.wo, lstm.wy})
+                                       lstm.wc, lstm.wf, lstm.wi, lstm.wo, lstm.wy}))
                        }
                }
        }()

datastream avatar Nov 21 '18 15:11 datastream

Thanks; I will have a look at it by December.

If you have fixed it, do not hesitate to send a PR.

owulveryck avatar Nov 27 '18 17:11 owulveryck

@owulveryck Managed to fix it? Getting the same error while calling: go get github.com/owulveryck/lstm

tzAcee avatar Mar 09 '21 11:03 tzAcee