-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_test.go
More file actions
36 lines (29 loc) · 778 Bytes
/
Copy pathmodel_test.go
File metadata and controls
36 lines (29 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"testing"
"github.com/harrydrippin/brusta-go/model"
)
func TestEval(T *testing.T) {
var e *model.Eval
var modelID int64
const (
modelPath = "./trace_model.pth"
targetFirstValue = 0.014204964
outputSize = 1
)
T.Run("NewEval", func(T *testing.T) {
e = model.NewEval()
})
T.Run("LoadModel", func(T *testing.T) {
modelID = e.LoadModel(modelPath, outputSize)
})
T.Run("Evaluate", func(T *testing.T) {
predictedValues := e.Evaluate(modelID, []float32{3.0, 2.0, 1.0})
if len(predictedValues) != 1 {
T.Fatalf("Predicted values are not matching with output size")
}
if targetFirstValue != predictedValues[0] {
T.Fatalf("Evaluated value %f is not equal with %f", predictedValues[0], targetFirstValue)
}
})
}