fix potential divide by zero fault when bf16s / fp16s enabled, fix #2125

This commit is contained in:
nihuini
2020-09-16 16:28:59 +08:00
parent 1c5af3d83c
commit b766c8cd9e
2 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -2513,7 +2513,7 @@ void VkTransfer::record_upload(const Mat& src, VkMat& dst, const Option& opt, bo
// NCNN_LOGE("record_upload src = %d | %d %d %d @ %d", src.dims, src.w, src.h, src.c, src.elempack);
// NOTE keep the hack here ?
if (src.elemsize == src.elempack * 4u)
if (src.elembits() == 32)
{
if (opt.use_fp16_storage || (opt.use_fp16_packed && src.elempack % 4 == 0))
{