summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/derived/globalphase_onnx_inside/test.sd
blob: 3e48f912931c1d9ab2f90b985c1148ca868bdc74 (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
schema test {

    document test {
        field aa type tensor(d1[3]) {
            indexing: attribute
        }
        field extra type float {
            indexing: attribute
        }
    }

    constant xx {
        file: files/const_xx.json
        type: tensor(d0[2],d1[3])
    }
    constant ww {
        file: files/const_ww.json
        type: tensor(d0[2])
    }

    rank-profile default {
        inputs {
            query(bb) tensor(d0[2])
            query(yy) tensor(d0[2])
        }
    }

    rank-profile simple inherits default {
        onnx-model direct {
            file: files/ax_plus_b.onnx
            input vector_A: attribute(aa)
            input matrix_X: constant(xx)
            input vector_B: query(bb)
            output vector_Y: out
        }
        first-phase {
            expression: sum(attribute(aa))
        }
        global-phase {
            rerank-count: 13
            expression: onnx(direct).out{d0:attribute(extra)}
        }
    }

    rank-profile one inherits default {
        onnx-model inside {
            file: files/ax_plus_b.onnx
            input vector_A: indirect_a
            input matrix_X: indirect_x
            input vector_B: indirect_b
            output vector_Y: foobar
        }
        first-phase {
            expression: sum(attribute(aa))
        }
        function handicap() {
            expression: query(yy)
        }
        global-phase {
            rerank-count: 13
            expression: sum(constant(ww) * (onnx(inside).foobar - handicap))
        }
        function indirect_a() {
            expression: attribute(aa)
        }
        function indirect_x() {
            expression: constant(xx)
        }
        function indirect_b() {
            expression: query(bb)
        }
    }

    rank-profile two inherits default {
        onnx-model twoside {
            file: files/ax_plus_b.onnx
            input vector_A: indirect_a
            input matrix_X: indirect_x
            input vector_B: indirect_b
            output vector_Y: foobar
        }
        first-phase {
            expression: sum(attribute(aa))
        }
        global-phase {
            rerank-count: 42
            expression: sum(constant(ww) * onnx(twoside).foobar)
        }
        function indirect_a() {
            expression: tensor(d1[3])(d1+attribute(extra))
        }
        function indirect_x() {
            expression: constant(xx)
        }
        function indirect_b() {
            expression: query(bb)
        }
    }

    rank-profile three inherits default {
        onnx-model another {
            file: files/ax_plus_b.onnx
            input vector_A: indirect_a
            input matrix_X: indirect_x
            input vector_B: indirect_b
            output vector_Y: foobar
        }
        first-phase {
            expression: sum(attribute(aa))
        }
        global-phase {
            rerank-count: 1001
            expression: sum(constant(ww) * onnx(another).foobar)
        }
        function indirect_a() {
            expression: tensor(d1[3]):[0.25, attribute(extra), 0.75]
        }
        function indirect_x() {
            expression: constant(xx)
        }
        function indirect_b() {
            expression: query(bb)
        }
    }

}