forked from oramasearch/onnx-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio_test.go
More file actions
39 lines (34 loc) · 740 Bytes
/
io_test.go
File metadata and controls
39 lines (34 loc) · 740 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
37
38
39
package onnx
import (
"testing"
"gorgonia.org/tensor"
)
func TestSetInput_nil_model(t *testing.T) {
defer func() {
if r := recover(); r != nil {
}
}()
m := new(Model)
tens := tensor.New()
err := m.SetInput(0, tens)
t.Fatal("should have paniced but have passed with error", err)
}
func TestGetInputTensors(t *testing.T) {
backend := newTestBackend()
n1 := backend.NewNode()
backend.AddNode(n1)
n2 := backend.NewNode()
backend.AddNode(n2)
n2.(*nodeTest).SetTensor(tensor.NewDense(tensor.Float32, []int{1, 1}))
model := &Model{
Input: []int64{n1.ID(), n2.ID()},
backend: backend,
}
input := model.GetInputTensors()
if len(input) != 2 {
t.FailNow()
}
if input[0] != nil || input[1] == nil {
t.Fail()
}
}