Skip to content

Commit

Permalink
Set element size in bits in ShapeUtil::FillNewShape for SubByteNonPre…
Browse files Browse the repository at this point in the history
…dTypes.

PiperOrigin-RevId: 717325258
  • Loading branch information
Google-ML-Automation committed Jan 20, 2025
1 parent 665f79f commit 8bdf9ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xla/shape_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ std::ostream& operator<<(std::ostream& out, const ShapeIndex& shape_index) {
shape->set_element_type(element_type);
const int ndims = dimensions.size();
auto layout = shape->mutable_layout();
if (primitive_util::IsSubByteNonPredType(element_type)) {
const int num_bits = primitive_util::BitWidth(element_type);
layout->set_element_size_in_bits(num_bits);
}
auto* minor_to_major = layout->mutable_minor_to_major();
int64_t static_extent_product = dense_shape_size;
bool any_overflows = false;
Expand Down

0 comments on commit 8bdf9ec

Please sign in to comment.