Skip to content

Commit

Permalink
fix stats construction
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Dec 19, 2024
1 parent 6761338 commit 4bbf23f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Galley/TensorStats/tensor-stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ copy_stats(stat::NaiveStats) = NaiveStats(copy_def(stat.def), stat.cardinality)

NaiveStats(index_set, dim_sizes, cardinality, default_value) = NaiveStats(TensorDef(index_set, dim_sizes, default_value, nothing), cardinality)

function NaiveStats(tensor::Tensor, indices)
function NaiveStats(tensor, indices)
if !(tensor isa Tensor)
tensor = Tensor(tensor)
end
def = TensorDef(tensor, indices)
cardinality = countstored(tensor)
return NaiveStats(def, cardinality)
Expand Down Expand Up @@ -746,7 +749,10 @@ function dense_dcs(def, int_2_idx, indices::Vector{Int})
return dcs
end

function DCStats(tensor::Tensor, indices)
function DCStats(tensor, indices)
if !(tensor isa Tensor)
tensor = Tensor(tensor)
end
def = TensorDef(tensor, indices)
idx_2_int = Dict{IndexExpr, Int}()
int_2_idx = Dict{Int, IndexExpr}()
Expand Down

0 comments on commit 4bbf23f

Please sign in to comment.