Skip to content

bump zip dependency + clippy + fmt #3199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ tokio = { version = "1.44.2", features = ["rt", "macros"] }
tracing-appender = "0.2.3"
tracing-core = "0.1.33"
tracing-subscriber = "0.3.19"
zip = "2.6.1"
zip = "3.0.0"

# Async handling
async-channel = "2.3"
Expand Down
2 changes: 2 additions & 0 deletions crates/burn-cubecl-fusion/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use serde::{Deserialize, Serialize};
/// Fusion optimization type for cubecl.
///
/// More optimization variants should be added here.
#[allow(clippy::large_enum_variant)]
pub enum CubeOptimization<R: Runtime> {
/// Element wise optimization.
ElementWise(ElemwiseOptimization<R>),
Expand All @@ -26,6 +27,7 @@ pub enum CubeOptimization<R: Runtime> {
/// Fusion optimization state type for cubecl.
///
/// More optimization variants should be added here.
#[allow(clippy::large_enum_variant)]
#[derive(Serialize, Deserialize)]
pub enum CubeOptimizationState {
/// Element wise state.
Expand Down
5 changes: 2 additions & 3 deletions crates/burn-dataset/src/dataset/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,13 @@ impl SqliteDatasetStorage {
///
/// * A `PathBuf` instance representing the file path.
pub fn db_file(&self) -> PathBuf {
let db_file = match &self.db_file {
match &self.db_file {
Some(db_file) => db_file.clone(),
None => {
let name = sanitize(self.name.as_ref().expect("Name is not set"));
Self::base_dir(self.base_dir.to_owned()).join(format!("{name}.db"))
}
};
db_file
}
}

/// Determines the base directory for storing the dataset.
Expand Down
7 changes: 3 additions & 4 deletions crates/burn-dataset/src/vision/image_folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ fn segmentation_mask_to_vec_usize(mask_path: &PathBuf) -> Vec<usize> {

// Image as Vec<PixelDepth>
// if rgb8 or rgb16, keep only the first channel assuming all channels are the same
let img_vec = match image.color() {

match image.color() {
ColorType::L8 => image.into_luma8().iter().map(|&x| x as usize).collect(),
ColorType::L16 => image.into_luma16().iter().map(|&x| x as usize).collect(),
ColorType::Rgb8 => image
Expand All @@ -158,9 +159,7 @@ fn segmentation_mask_to_vec_usize(mask_path: &PathBuf) -> Vec<usize> {
.map(|&x| x as usize)
.collect(),
_ => panic!("Unrecognized image color type"),
};

img_vec
}
}

/// Parse the image annotation to the corresponding type.
Expand Down
6 changes: 2 additions & 4 deletions crates/burn-fusion/src/stream/store/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ impl ExecutionPlanIndex {
None => return Vec::new(),
};

let val = match self.starters.get(*index) {
match self.starters.get(*index) {
Some(value) => value.clone(),
None => Vec::new(),
};

val
}
}

/// Update the index for an execution plan starting with operation `ops`
Expand Down
2 changes: 1 addition & 1 deletion crates/burn-tch/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl TchTensor {
/// Returns `true` if the tensor's stride does not contain zero (no broadcasting)
/// and the storage can be mutated.
pub fn can_mut(&self) -> bool {
let stride_contains_zero = self.tensor.stride().iter().any(|&s| s == 0);
let stride_contains_zero = self.tensor.stride().contains(&0);

!stride_contains_zero && self.storage.can_mut()
}
Expand Down
6 changes: 3 additions & 3 deletions crates/burn-tensor/src/tensor/api/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,8 @@ where
/// If the tensor doesn't have one element.
pub async fn into_scalar_async(self) -> K::Elem {
check!(TensorCheck::into_scalar::<D>(&self.shape()));
let x = self.into_data_async().await.iter().next().unwrap();
x

self.into_data_async().await.iter().next().unwrap()
}

/// Broadcast the tensor to the given shape.
Expand Down Expand Up @@ -3076,7 +3076,7 @@ impl<const D1: usize, const D2: usize, E: Element> BroadcastArgs<D1, D2> for [E;
.rev()
.collect();

if new_shape.iter().any(|&x| x == 0) {
if new_shape.contains(&0) {
panic!("Cannot substitute -1 for a non-existing dimension");
}

Expand Down
1 change: 1 addition & 0 deletions crates/burn-train/src/renderer/tui/metric_numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl NumericMetricsState {
}
}

#[allow(clippy::large_enum_variant)]
#[derive(new)]
pub(crate) enum NumericMetricView<'a> {
Plots(&'a [String], usize, Chart<'a>, PlotKind),
Expand Down
5 changes: 2 additions & 3 deletions crates/onnx-ir/src/node/unsqueeze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ pub fn unsqueeze_update_output(node: &mut Node) {
None => None,
}
} else {
let axes = node.attrs.get("axes").cloned().map(|v| {
node.attrs.get("axes").cloned().map(|v| {
let axes = v.into_i64s();
log::debug!(
"Unsqueeze axes from attribute for {}: {:?}",
node.name,
axes
);
axes
});
axes
})
};

let input_rank = match &node.inputs[0].ty {
Expand Down
Loading