pytaco.write

pytaco.write(filename, t)

Writes a tensor to a file.

Writes the input tensor t to the file specified by filename using the extension given in the filename. This function only supports writing the extensions listed in the Tensor I/O section.

Parameters
filename: string

The name of the file the tensor will be written to. The file must be given an extension of the .mtx, .tns or .rb.

t: tensor

The tensor to write to filename.

Notes

This function forces tensor compilation.

Examples

To write to a .tns file we can do the following:

>>> import pytaco as pt
>>> a = pt.tensor([2, 2], [pt.dense, pt.compressed], dtype=pt.float32)
>>> a.insert([0, 0], 10)
>>> pt.write("simple_test.tns", a)