We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a6fe23a + b245b72 commit 0fb9130Copy full SHA for 0fb9130
src/ops/norm.rs
@@ -176,14 +176,16 @@ pub fn batch_norm_in_place(
176
177
input.make_contiguous();
178
179
- for n in 0..batch {
+ let chunk_len = input.len() / (batch * chans);
180
+ let mut chunks = input.data_mut().unwrap().chunks_mut(chunk_len);
181
+
182
+ for _ in 0..batch {
183
for c in 0..chans {
184
let chan_mean = mean[c];
185
let chan_var = var[c];
186
let chan_scale = scale[c];
187
let chan_bias = bias[c];
- let mut chan = input.slice_mut([n, c]);
- let chan_data = chan.data_mut().unwrap();
188
+ let chan_data = chunks.next().unwrap();
189
190
normalize_slice(
191
chan_data.into(),
0 commit comments