Skip to content

Commit

Permalink
fix histogram UT failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hjhee committed Aug 15, 2024
1 parent ba7b577 commit 2b5716e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ATen/native/xpu/Histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ static Tensor& histogramdd_out(
bin_edges[dim].copy_(bins[dim]);
}

std::vector<Tensor> bin_edges_contig(bin_edges.size());
for (const auto dim : c10::irange(bin_edges_contig.size())) {
bin_edges_contig[dim] = bin_edges[dim].contiguous();
}
TensorList bin_edges_contig_tl(bin_edges_contig);

const int64_t N = self.size(-1);
const int64_t M = std::accumulate(
self.sizes().begin(),
Expand All @@ -398,7 +404,7 @@ static Tensor& histogramdd_out(
reshaped_weight,
density,
hist,
bin_edges,
bin_edges_contig_tl,
outer_bin_edges,
true);
return hist;
Expand Down Expand Up @@ -484,7 +490,7 @@ std::tuple<Tensor&, Tensor&> XPUNativeFunctions::histogram_out(
reshaped_weight,
density,
hist,
bin_edges,
bin_edges.contiguous(),
outer_bin_edges,
true);
return std::forward_as_tuple(hist, bin_edges);
Expand Down

0 comments on commit 2b5716e

Please sign in to comment.