未验证 提交 7a82b6de 编写于 作者: H HongyuJia 提交者: GitHub

Use inference, save construct time (#50163)

上级 cd6ebca6
...@@ -67,17 +67,19 @@ class KernelKey { ...@@ -67,17 +67,19 @@ class KernelKey {
KernelKey(Backend backend, DataLayout layout, DataType dtype) KernelKey(Backend backend, DataLayout layout, DataType dtype)
: backend_(backend), layout_(layout), dtype_(dtype) {} : backend_(backend), layout_(layout), dtype_(dtype) {}
explicit KernelKey(Place place) explicit KernelKey(const Place& place)
: backend_(TransToPhiBackend(place)), : backend_(TransToPhiBackend(place)),
layout_(DataLayout::ALL_LAYOUT), layout_(DataLayout::ALL_LAYOUT),
dtype_(DataType::ALL_DTYPE) {} dtype_(DataType::ALL_DTYPE) {}
explicit KernelKey(const int& dtype, Place place) explicit KernelKey(const int& dtype, const Place& place)
: backend_(TransToPhiBackend(place)), : backend_(TransToPhiBackend(place)),
layout_(DataLayout::ALL_LAYOUT), layout_(DataLayout::ALL_LAYOUT),
dtype_(phi::TransToPhiDataType(dtype)) {} 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_(TransToPhiBackend(place)), layout_(layout), dtype_(dtype) {}
Backend backend() const { return backend_; } Backend backend() const { return backend_; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册