pytaco.as_tensor
- pytaco.as_tensor(obj, copy=True)
Converts array_like or scipy csr and csr to tensors.
Converts an array_like object (list of lists, etc..) or scipy csr and csc matrices to a taco tensor.
- Parameters
- obj: array_like, scipy.sparse.csr_matrix, scipy.sparse.csc_matrix, tensor
The object to convert to a taco tensor. If the object is a tensor, it will be copied depending on the copy flag.
- copy: boolean. optional
If true, taco will attempt to take a reference to the input if possible. If false, taco will always copy the input.
- Returns
- t: tensor
A tensor initialized with the data from the object passed in.
Notes
This method internally uses
from_array()
,from_sp_csr()
andfrom_sp_csc()
. As a result the restrictions to those methods and their copy parameters apply here. For instance, non-contiguous arrays will always be copied regardless of the copy flag.Python objects will also always be copied since this internally uses np.array to create an array_like object.