(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func TestSessionRunNeg(t *testing.T) { |
| 39 | var tests = []struct { |
| 40 | input interface{} |
| 41 | expected interface{} |
| 42 | }{ |
| 43 | {int64(1), int64(-1)}, |
| 44 | {[]float64{-1, -2, 3}, []float64{1, 2, -3}}, |
| 45 | {[][]float32{{1, -2}, {-3, 4}}, [][]float32{{-1, 2}, {3, -4}}}, |
| 46 | } |
| 47 | |
| 48 | for _, test := range tests { |
| 49 | t.Run(fmt.Sprint(test.input), func(t *testing.T) { |
| 50 | t1, err := NewTensor(test.input) |
| 51 | if err != nil { |
| 52 | t.Fatal(err) |
| 53 | } |
| 54 | graph, inp, out := createTestGraph(t, t1.DataType()) |
| 55 | s, err := NewSession(graph, &SessionOptions{}) |
| 56 | if err != nil { |
| 57 | t.Fatal(err) |
| 58 | } |
| 59 | output, err := s.Run(map[Output]*Tensor{inp: t1}, []Output{out}, []*Operation{out.Op}) |
| 60 | if err != nil { |
| 61 | t.Fatal(err) |
| 62 | } |
| 63 | if len(output) != 1 { |
| 64 | t.Fatalf("got %d outputs, want 1", len(output)) |
| 65 | } |
| 66 | val := output[0].Value() |
| 67 | if !reflect.DeepEqual(test.expected, val) { |
| 68 | t.Errorf("got %v, want %v", val, test.expected) |
| 69 | } |
| 70 | if err := s.Close(); err != nil { |
| 71 | t.Error(err) |
| 72 | } |
| 73 | }) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func TestSessionRunConcat(t *testing.T) { |
| 78 | // Runs the Concat operation on two matrices: m1 and m2, along the |
nothing calls this directly
no test coverage detected