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