Skip to content

Commit a3ecb64

Browse files
committed
fix(ci): replace remaining &[x.clone()] with std::slice::from_ref(&x) for Rust 1.100 clippy
1 parent 9ad44af commit a3ecb64

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎crates/oxideon-core/tests/cuda_no_host_fallbacks.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn cumprod_runs_on_the_gpu_including_zeros() {
6666
v[24] = 0.0;
6767
let x = Tensor::from_slice(&v, &[2, 6, 3]).unwrap();
6868
for axis in [0isize, 1, 2, -1] {
69-
check(&format!("cumprod axis {axis}"), &[x.clone()], |t| t[0].cumprod(axis).unwrap());
69+
check(&format!("cumprod axis {axis}"), std::slice::from_ref(&x), |t| t[0].cumprod(axis).unwrap());
7070
}
7171
}
7272

‎crates/oxideon-core/tests/opgraph_fusion.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn conv_bn_relu_followed_by_more_ops_and_with_other_consumers() {
4747
let y = eager_conv_bn(&x, &w, &b, &g, &be, &m, &v, eps).relu().unwrap();
4848
y.mul_scalar(3.0).unwrap().add(&y).unwrap()
4949
};
50-
close("conv+bn+relu then more ops", &comp.run(&[x.clone()]).unwrap()[0], &want);
50+
close("conv+bn+relu then more ops", &comp.run(std::slice::from_ref(&x)).unwrap()[0], &want);
5151
// a second input must work too (the fusion folded constants, not data)
5252
let x2 = rnd(&[2, 3, 6, 6], 50.0);
5353
let want2 = {

‎crates/oxideon-core/tests/unary_backward.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ fn second_derivatives_still_work() {
4848
// d²/dx² tanh(x) = -2 tanh(x) (1 - tanh(x)²)
4949
let x = rnd(100, 2.0).detach().requires_grad_(true);
5050
let y = x.tanh().unwrap().sum().unwrap();
51-
let g = grad(&[y], &[x.clone()], None, true).unwrap().remove(0).unwrap();
52-
let gg = grad(&[g.sum().unwrap()], &[x.clone()], None, false).unwrap().remove(0).unwrap();
51+
let g = grad(&[y], std::slice::from_ref(&x), None, true).unwrap().remove(0).unwrap();
52+
let gg = grad(&[g.sum().unwrap()], std::slice::from_ref(&x), None, false).unwrap().remove(0).unwrap();
5353
let t = x.detach().tanh().unwrap();
5454
let want = t.mul_scalar(-2.0).unwrap().mul(&t.square().unwrap().neg().unwrap().add_scalar(1.0).unwrap()).unwrap();
5555
close(&gg, &want, 1e-5, "tanh second derivative");

0 commit comments

Comments
 (0)