pytaco.remove_explicit_zeros

pytaco.remove_explicit_zeros(t, new_fmt=None, new_dtype=None)

Creates a tensor without explicit zeros.

Parameters
t: tensor, array_like

The object to convert to a tensor without explicit zeros.

new_fmt:class:format, optional

The format to use for the storage of the new tensor. If not specified, the format of t is used.

new_dtype:class:dtype, optional

The dtype to use for the new tensor. If not specified, the dtype of t is used.

Returns
new_t: tensor

A new tensor with all of its explicit zeros removed if new_fmt is not dense.

Notes

If new_fmt is dense, then this function is forced to keep explicit zeros in the tensor in order for the data layout to be correct.