From de6451534c7a3d1bfe6b2efb0346ca77c78815a4 Mon Sep 17 00:00:00 2001 From: duanboqiang Date: Tue, 24 Aug 2021 16:55:29 +0800 Subject: [PATCH] fix bmm bug (#35098) * fix bmm bug * bmm style * fix bmm --- paddle/fluid/operators/bmm_op.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/operators/bmm_op.h b/paddle/fluid/operators/bmm_op.h index 49104d4f08..15cd6de913 100644 --- a/paddle/fluid/operators/bmm_op.h +++ b/paddle/fluid/operators/bmm_op.h @@ -64,6 +64,10 @@ class BmmKernel : public framework::OpKernel { Tensor *out = context.Output("Out"); out->mutable_data(context.GetPlace()); + if (x.numel() == 0 || y.numel() == 0) { + return; + } + auto blas = math::GetBlas(context); auto mat_dim_a = math::CreateMatrixDescriptor(x.dims(), 0, false); -- GitLab