未验证 提交 1431305e 编写于 作者: Z zyfncg 提交者: GitHub

fix kernel backend select bug (#41002)

上级 d101334c
...@@ -25,6 +25,7 @@ namespace experimental { ...@@ -25,6 +25,7 @@ namespace experimental {
namespace detail { namespace detail {
BackendSet GetTensorBackendSet(const phi::TensorBase& t) { BackendSet GetTensorBackendSet(const phi::TensorBase& t) {
if (t.initialized()) {
BackendSet backend_set(phi::TransToPhiBackend(t.place())); BackendSet backend_set(phi::TransToPhiBackend(t.place()));
switch (t.layout()) { switch (t.layout()) {
case DataLayout::MKLDNN: case DataLayout::MKLDNN:
...@@ -35,6 +36,8 @@ BackendSet GetTensorBackendSet(const phi::TensorBase& t) { ...@@ -35,6 +36,8 @@ BackendSet GetTensorBackendSet(const phi::TensorBase& t) {
break; break;
} }
return backend_set; return backend_set;
}
return BackendSet(Backend::UNDEFINED);
} }
std::size_t CountLeadingZeros(uint64_t val) { std::size_t CountLeadingZeros(uint64_t val) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册