Fix view scalar bug segfault (#1603)

* fix view scalar bug

* fix view scalar bug

* one more fix
This commit is contained in:
Awni Hannun
2024-11-19 10:54:05 -08:00
committed by GitHub
parent 5e89aace9b
commit 61d787726a
4 changed files with 7 additions and 3 deletions

View File

@@ -4587,7 +4587,7 @@ array view(const array& a, const Dtype& dtype, StreamOrDevice s /* = {} */) {
" axis must be a multiple of the requested type size.");
}
out_shape.back() /= (obytes / ibytes);
} else {
} else if (ibytes > obytes) {
// Type size ratios are always integers
out_shape.back() *= (ibytes / obytes);
}