<jupyter_start><jupyter_text>Tool for transforming tensors using the hierarchical fiber abstractionFirst, include some libraries<jupyter_code># Run boilerplate code to set up environment

%run ../prelude.py<jupyter_output><empty_output><jupyter_text>Display a tensor Following is an example of reading in a tensor and displaying it<jupyter_code># Display an example tensor

filename = datafileName("draw-c.yaml")
a = Tensor(filename)

displayTensor(a)
displayTensor(a)

b0 = a.splitUniform(25, depth=0)
displayTensor(b0)

b1 = a.splitUniform(15, depth=1)
displayTensor(b1)

b2 = a.splitUniform(4, depth=2)
displayTensor(b2)

displayTensor(a)

c0 = a.splitNonUniform([0, 15, 35], depth=0)
displayTensor(c0)

c1 = a.splitNonUniform([0, 15, 25], depth=1)
displayTensor(c1)

c2 = a.splitNonUniform([0, 4, 19], depth=2)
displayTensor(c2)

displayTensor(a)

d0 = a.splitEqual(2, depth=0)
displayTensor(d0)

d1 = a.splitEqual(2, depth=1)
displayTensor(d1)

d2 = a.splitEqual(2, depth=2)
displayTensor(d2)

displayTensor(a)

e0 = a.splitUnEqual([2, 1], depth=0)
displayTensor(e0)

e1 = a.splitUnEqual([2, 1], depth=1)
displayTensor(e1)

e2 = a.splitUnEqual([2, 1], depth=2)
displayTensor(e2)

displayTensor(a)

f0 = a.swapRanks(depth=0)
displayTensor(f0)

f1 = a.swapRanks(depth=1)
displayTensor(f1)

displayTensor(a)

g0 = a.flattenRanks(depth=0)
displayTensor(g0)

g1 = a.flattenRanks(depth=1)
displayTensor(g1)


displayTensor(a)

h0 = g0.unflattenRanks(depth=0)
displayTensor(h0)

h1 = g1.unflattenRanks(depth=1)
displayTensor(h1)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup