Skip to content

Commit

Permalink
avoid unnecessary unsqueeze
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Oct 29, 2024
1 parent 151fddc commit 57c562b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,24 @@ impl<B: Backend> Batcher<FSRSItem, FSRSBatch<B>> for FSRSBatcher<B> {
item.history().map(|r| (r.delta_t, r.rating)).unzip();
delta_t.resize(pad_size, 0);
rating.resize(pad_size, 0);
let delta_t = Tensor::<B, 1>::from_floats(
let delta_t = Tensor::<B, 2>::from_floats(
TensorData::new(
delta_t,
Shape {
dims: vec![pad_size],
dims: vec![1, pad_size],
},
),
&self.device,
)
.unsqueeze();
let rating = Tensor::<B, 1>::from_data(
);
let rating = Tensor::<B, 2>::from_data(
TensorData::new(
rating,
Shape {
dims: vec![pad_size],
dims: vec![1, pad_size],
},
),
&self.device,
)
.unsqueeze();
);
(delta_t, rating)
})
.unzip();
Expand Down

0 comments on commit 57c562b

Please sign in to comment.