1# model
2model = Model()
3sparseData = Input("sparseData", "TENSOR_BOOL8", "{8}")
4traversalOrder = Parameter("traversalOrder", "TENSOR_INT32", "{3}", [0, 2, 1])
5blockMap = Parameter("blockMap", "TENSOR_INT32", "{0}", [])
6dimFormat = Parameter("dimFormat", "TENSOR_INT32", "{3}", [1, 1, 1])
7dimensions = Parameter("dimensions", "TENSOR_INT32", "{3}", [3, 4, 2])
8d0ArrSegments = Parameter("d0ArrSegments", "TENSOR_INT32", "{2}", [0, 2])
9d0ArrIndices = Parameter("d0ArrIndices", "TENSOR_INT32", "{2}", [0, 2])
10d1ArrSegments = Parameter("d1ArrSegments", "TENSOR_INT32", "{3}", [0, 2, 5])
11d1ArrIndices = Parameter("d1ArrIndices", "TENSOR_INT32", "{5}", [0, 2, 0, 2, 3])
12d2ArrSegments = Parameter("d2ArrSegments", "TENSOR_INT32", "{6}", [0, 2, 3, 4, 6, 8])
13d2ArrIndices = Parameter("d2ArrIndices", "TENSOR_INT32", "{8}", [0, 1, 1, 1, 0, 1, 0, 1])
14denseOut = Output("denseOut", "TENSOR_BOOL8", "{3, 2, 4}")
15model = model.Operation("DENSIFY", sparseData, traversalOrder, blockMap, dimFormat,
16                        dimensions, d0ArrSegments, d0ArrIndices, d1ArrSegments,
17                        d1ArrIndices, d2ArrSegments, d2ArrIndices).To(denseOut)
18
19# Example 1. Input in operand 0,
20input0 = {sparseData: # input 0
21          [1, 1, 1, 1, 1, 1, 1, 1]}
22
23output0 = {denseOut: # output 0
24           [1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
25           0, 0, 0, 1, 1, 1, 0, 1, 1]}
26
27# Instantiate an example
28Example((input0, output0))
29