(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestShapeAttribute(t *testing.T) { |
| 63 | s := NewScope() |
| 64 | x := Placeholder(s.SubScope("x"), tf.Int32, PlaceholderShape(tf.MakeShape(1))) |
| 65 | y := Placeholder(s.SubScope("y"), tf.Int32, PlaceholderShape(tf.Shape{})) |
| 66 | z := Add(s, x, y) |
| 67 | graph, err := s.Finalize() |
| 68 | if err != nil { |
| 69 | t.Fatal(err) |
| 70 | } |
| 71 | sess, err := tf.NewSession(graph, nil) |
| 72 | if err != nil { |
| 73 | t.Fatal(err) |
| 74 | } |
| 75 | |
| 76 | value, err := tf.NewTensor([]int32{7}) |
| 77 | if err != nil { |
| 78 | t.Fatal(err) |
| 79 | } |
| 80 | feeds := map[tf.Output]*tf.Tensor{ |
| 81 | x: value, |
| 82 | y: value, |
| 83 | } |
| 84 | fetched, err := sess.Run(feeds, []tf.Output{z}, nil) |
| 85 | if err != nil { |
| 86 | t.Fatal(err) |
| 87 | } |
| 88 | if got, want := len(fetched), 1; got != want { |
| 89 | t.Fatalf("Fetched %d tensors, expected %d", got, want) |
| 90 | } |
| 91 | if got, want := fetched[0].Value().([]int32), []int32{14}; len(got) != len(want) || len(got) != 1 || got[0] != want[0] { |
| 92 | t.Fatalf("Got %v, want %v", got, want) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | func TestDataset(t *testing.T) { |
| 97 | var ( |
nothing calls this directly
no test coverage detected