Skip to content

Commit

Permalink
post merge
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Dec 18, 2024
1 parent 02a9787 commit 45c7118
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions crates/viewer/re_data_ui/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use re_viewer_context::{TensorStats, TensorStatsCache, UiLayout, ViewerContext};
use super::EntityDataUi;

fn format_tensor_shape_single_line(tensor: &TensorData) -> String {
const MAX_SHOWN: usize = 4; // should be enough for width/height/depth and then some!
let short_shape = &tensor.shape[0..tensor.shape.len().min(MAX_SHOWN)];
let has_names = short_shape
let has_names = tensor
.shape
.iter()
.enumerate()
.any(|(dim_idx, _)| tensor.dim_name(dim_idx).is_some());
let shapes = short_shape
tensor
.shape
.iter()
.enumerate()
.map(|(dim_idx, dim_len)| {
Expand All @@ -29,19 +29,7 @@ fn format_tensor_shape_single_line(tensor: &TensorData) -> String {
}
)
})
.join(if has_names { " × " } else { "×" });
format!(
"{shapes}{}",
if MAX_SHOWN < tensor.shape.len() {
if has_names {
" × …"
} else {
"×…"
}
} else {
""
}
)
.join(if has_names { " × " } else { "×" })
}

impl EntityDataUi for re_types::components::TensorData {
Expand Down

0 comments on commit 45c7118

Please sign in to comment.