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
|
# Sample Stack or Pack model
model = Model()
i1 = Input("input1", "TENSOR_FLOAT32", "{6, 4}")
i2 = Input("input2", "TENSOR_FLOAT32", "{6, 4}")
i3 = Input("input3", "TENSOR_FLOAT32", "{6, 4}")
num = Int32Scalar("num_tensors", 3)
axis = Int32Scalar("axis", 0)
out = Output("output", "TENSOR_FLOAT32", "{3, 6, 4}")
model = model.Operation("PACK_EX", i1, i2, i3, num, axis).To(out)
input0 = {i1: # input 0
[0.3, 1.0, 2.0, 3.0,
4.0, 5.5, 6.3, 7.2,
8.22, 9.8, 10.3, 11.0,
12.22, 13.2, 14.44, 15.32,
16.55, 17.33, 18.1, 19.0,
20.32, 21.9, 22.1, 23.22],
i2: # input 1
[24.22, 25.1, 26.0, 27.12,
28.32, 29.11, 30.0, 31.98,
32.99, 33.11, 34.1, 35.123,
36.21, 37.22, 38.23, 39.76,
40.1, 41.43, 42.34, 43.1,
44.123, 45.43, 46.1, 47.1],
i3: # input 2
[48.0, 49.76, 50.0, 51.1,
52.22, 53.12, 54.1, 55.5,
56.5, 57.4, 58.1, 59.23,
60.2, 61.12, 62.11, 63.34,
64.11, 65.1, 66.43, 67.1,
68.1, 69.34, 70.11, 71.45]}
output0 = {out: # output 0
[0.3, 1.0, 2.0, 3.0,
4.0, 5.5, 6.3, 7.2,
8.22, 9.8, 10.3, 11.0,
12.22, 13.2, 14.44, 15.32,
16.55, 17.33, 18.1, 19.0,
20.32, 21.9, 22.1, 23.22,
24.22, 25.1, 26.0, 27.12,
28.32, 29.11, 30.0, 31.98,
32.99, 33.11, 34.1, 35.123,
36.21, 37.22, 38.23, 39.76,
40.1, 41.43, 42.34, 43.1,
44.123, 45.43, 46.1, 47.1,
48.0, 49.76, 50.0, 51.1,
52.22, 53.12, 54.1, 55.5,
56.5, 57.4, 58.1, 59.23,
60.2, 61.12, 62.11, 63.34,
64.11, 65.1, 66.43, 67.1,
68.1, 69.34, 70.11, 71.45]}
# Instantiate an example
Example((input0, output0))
|