From 3d514e4898ed6ec92a4027e7af3ed88ee5dafcc8 Mon Sep 17 00:00:00 2001 From: Wilber Date: Wed, 24 Aug 2022 08:31:38 +0800 Subject: [PATCH] fix convert weight failed. (#45346) --- .../inference/analysis/passes/convert_to_mixed_precision.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paddle/fluid/inference/analysis/passes/convert_to_mixed_precision.cc b/paddle/fluid/inference/analysis/passes/convert_to_mixed_precision.cc index ca7d18669ff..d786159078d 100644 --- a/paddle/fluid/inference/analysis/passes/convert_to_mixed_precision.cc +++ b/paddle/fluid/inference/analysis/passes/convert_to_mixed_precision.cc @@ -162,6 +162,8 @@ void SaveMixedModel( if (var->IsType() || var->IsType()) { auto* t = var->GetMutable(); + if (t->dtype() != phi::DataType::FLOAT32) continue; + framework::Tensor mixed_tensor; mixed_tensor.Resize(t->dims()); auto* data = t->mutable_data(platform::CPUPlace()); -- GitLab