Skip to content

Commit

Permalink
chore: Add back default debug_struct in Debug for Tensor impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarflakstad committed Oct 29, 2024
1 parent 99a074e commit b74e4b2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/ratchet-core/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ impl std::fmt::Debug for Tensor {
match self.device() {
Device::CPU => match self.dt() {
DType::F32 => self.to_ndarray_view::<f32>().fmt(f),
_ => unimplemented!("Debug not implemented for {:?}", self.dt()),
_ => {
let storage_fmt = self.storage().as_ref().map(|s| s.dump(self.dt(), false));
let (id, op) = (self.id(), self.op());
f.debug_struct("Tensor")
.field("id", &id)
.field("shape", &self.shape())
.field("dt", &self.dt())
.field("op", &op)
.field("storage", &storage_fmt)
.finish()
}
},
Device::GPU(_) => {
let storage_fmt = self.storage().as_ref().map(|s| s.dump(self.dt(), false));
Expand Down

0 comments on commit b74e4b2

Please sign in to comment.