willow-ahrens / Finch.jl

Sparse tensors in Julia and more! Datastructure-driven array programing language.
http://willowahrens.io/Finch.jl/
MIT License
151 stars 12 forks source link

`tensordot` - input and output eltypes differences #577

Closed mtsokol closed 3 weeks ago

mtsokol commented 1 month ago

Hi @willow-ahrens,

I think another detail, connected to https://github.com/willow-ahrens/Finch.jl/issues/576, is that we would like to have similar input and output dtypes (rather a detail, so only if it's easy):

julia> using Finch

julia> a = Tensor(ones(UInt8, 1))
1-Tensor
└─ Dense [1:1]
   └─ [1]: 1

julia> b = Tensor(ones(UInt8, 1))
1-Tensor
└─ Dense [1:1]
   └─ [1]: 1

julia> eltype(a)
UInt8

julia> eltype(b)
UInt8

julia> eltype(Finch.tensordot(a, b, 0))
Float64  # would expect UInt8