willow-ahrens / Finch.jl

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

`DimensionMismatch` when broadcasting singleton dimensions #529

Closed mtsokol closed 2 months ago

mtsokol commented 2 months ago

Hi @willow-ahrens,

While implementing SDDMM I found that broadcasting of singleton dimensions fails - here's code for reproducing it:

using Finch

a = ones(1, 10, 10);
b = ones(10, 1, 10);
broadcast(.*, a, b);

a_tns = Tensor(a);
b_tns = Tensor(b);

broadcast(.*, a_tns, b_tns);  # ERROR: DimensionMismatch: mismatched dimension limits (10 != 1)