pytaco.tensor.insert
- tensor.insert(coords, val)
Increments the value at a given set of coordinates.
- Parameters
- coords: iter of ints
The coordinates of the tensor element we want to assign to.
- val: dtype
The value to assign the specified element to.
Warning
This function does not overwrite the element at the specified coordinates if it is already non-zero.
Notes
Setitem was purposely not overridden to not confuse users with the semantics. This function will increment the value at a given coordinate. We anticipate that data will be read into taco using the variety of functions provided in Tensor I/O.
This will be changed in a future release.
Examples
>>> import pytaco as pt >>> t = pt.tensor([2, 2]) >>> t.insert([0, 0], 10) >>> t[0, 0] 10.0 >>> t.insert([0, 0], 100) >>> t[0, 0] 110.0