Skip to content

Commit 0dbff7e

Browse files
CaoEpytorchmergebot
authored andcommitted
Add MKLDNN support for Half GELU (pytorch#145339)
Add MKLDNN support for Half GELU to align with BFloat16. Pull Request resolved: pytorch#145339 Approved by: https://github.com/yanbing-j, https://github.com/leslie-fang-intel, https://github.com/Skylion007
1 parent 0efa843 commit 0dbff7e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aten/src/ATen/native/Activation.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ static bool use_mkldnn(const Tensor& input) {
382382
return (input.is_mkldnn()) || // input is mkldnn Tensor
383383
(input.device().is_cpu() &&
384384
(((input.scalar_type() == kBFloat16) && mkldnn_bf16_device_check()) ||
385-
(input.scalar_type() == kFloat))); // input is dense layout and bfloat16/float32
385+
((input.scalar_type() == kHalf) && mkldnn_fp16_device_check()) ||
386+
(input.scalar_type() == kFloat))); // input is dense layout and bfloat16/float16/float32
386387
}
387388
#endif
388389

0 commit comments

Comments
 (0)