pytaco.tensor.pack

tensor.pack()

Packs a tensor.

When performing inserts, taco will place new values in a buffer to avoid recreating sparse structures on every insert. As a result, data is not immediately updated to the tensor. Taco will automatically do this when needed (for example before printing, computing, writing to a file, iterating etc..) but we expose this mechanism to allow the user to explicitly pack a tensor themselves.

It is advised to explicitly pack tensors before taking timing measurements since this is not considered to be part of the kernel computation.

Examples

>>> import pytaco as pt
>>> a = pt.tensor([2, 2])
>>> a.insert([0, 0], 10) # 10 is in a buffer
>>> a.pack() # 10 is now in matrix structure.