MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TestOperationAttrs

Function TestOperationAttrs

tensorflow/go/attrs_test.go:25–193  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestOperationAttrs(t *testing.T) {
26 g := NewGraph()
27
28 i := 0
29 makeConst := func(v interface{}) Output {
30 op, err := Const(g, fmt.Sprintf("const/%d/%+v", i, v), v)
31 i++
32 if err != nil {
33 t.Fatal(err)
34 }
35 return op
36 }
37
38 makeTensor := func(v interface{}) *Tensor {
39 tensor, err := NewTensor(v)
40 if err != nil {
41 t.Fatal(err)
42 }
43 return tensor
44 }
45
46 cases := []OpSpec{
47 {
48 Name: "type",
49 Type: "Placeholder",
50 Attrs: map[string]interface{}{
51 "dtype": Float,
52 },
53 },
54 {
55 Name: "list(float)",
56 Type: "Bucketize",
57 Input: []Input{
58 makeConst([]float32{1, 2, 3, 4}),
59 },
60 Attrs: map[string]interface{}{
61 "boundaries": []float32{0, 1, 2, 3, 4, 5},
62 },
63 },
64 {
65 Name: "list(float) empty",
66 Type: "Bucketize",
67 Input: []Input{
68 makeConst([]float32{}),
69 },
70 Attrs: map[string]interface{}{
71 "boundaries": []float32(nil),
72 },
73 },
74 /* TODO(ashankar): debug this issue and add it back later.
75 {
76 Name: "list(type),list(shape)",
77 Type: "InfeedEnqueueTuple",
78 Input: []Input{
79 OutputList([]Output{
80 makeConst(float32(1)),
81 makeConst([][]int32{{2}}),
82 }),

Callers

nothing calls this directly

Calls 8

AddOperationMethod · 0.95
NewGraphFunction · 0.85
NewTensorFunction · 0.85
int64Function · 0.85
makeTensorFunction · 0.85
ConstFunction · 0.50
AttrMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected