finch-tensor / finch-tensor-python

Sparse and Structured Tensor Programming in Python
MIT License
8 stars 3 forks source link

API: Add support for scalars #26

Closed mtsokol closed 6 months ago

mtsokol commented 6 months ago

Issue: #25

Hi @willow-ahrens @hameerabbasi,

This is a WIP PR that is meant to introduce support and tests for scalars. It will change as the discussion about scalars continues.

Out of curiosity I tried to represent scalars as: SwizzleArray(Tensor(Element{1, Int64, Int64}([1])), ()), but as expected, for some operations it causes densification of Tensors.

willow-ahrens commented 6 months ago

For performance, we probably do want to use a Finch.Scalar type, as these avoid some overhead associated with Element, since Element needs to be fancy to be the leaf level of a tensor

willow-ahrens commented 6 months ago

Finch also supports a SparseScalar type that has a customizeable default

mtsokol commented 6 months ago

Replaced by https://github.com/willow-ahrens/finch-tensor/pull/27