From 7a82b6dec6238b5805d60bc86811925a5fbb99c7 Mon Sep 17 00:00:00 2001 From: HongyuJia Date: Wed, 8 Feb 2023 15:49:06 +0800 Subject: [PATCH] Use inference, save construct time (#50163) --- paddle/phi/core/kernel_factory.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/paddle/phi/core/kernel_factory.h b/paddle/phi/core/kernel_factory.h index 0c85f8d49c..d69cb7802b 100644 --- a/paddle/phi/core/kernel_factory.h +++ b/paddle/phi/core/kernel_factory.h @@ -67,17 +67,19 @@ class KernelKey { KernelKey(Backend backend, DataLayout layout, DataType dtype) : backend_(backend), layout_(layout), dtype_(dtype) {} - explicit KernelKey(Place place) + explicit KernelKey(const Place& place) : backend_(TransToPhiBackend(place)), layout_(DataLayout::ALL_LAYOUT), dtype_(DataType::ALL_DTYPE) {} - explicit KernelKey(const int& dtype, Place place) + explicit KernelKey(const int& dtype, const Place& place) : backend_(TransToPhiBackend(place)), layout_(DataLayout::ALL_LAYOUT), dtype_(phi::TransToPhiDataType(dtype)) {} - explicit KernelKey(Place place, DataLayout layout, DataType dtype) + explicit KernelKey(const Place& place, + const DataLayout& layout, + const DataType& dtype) : backend_(TransToPhiBackend(place)), layout_(layout), dtype_(dtype) {} Backend backend() const { return backend_; } -- GitLab