Skip to content

Commit 79736ff

Browse files
ShawnZhongfacebook-github-bot
authored andcommitted
Simplify complex case for div_cpu (#39996)
Summary: Simplify complex case for `div_cpu` cc: zasdfgbnm Pull Request resolved: #39996 Differential Revision: D22169715 Pulled By: anjali411 fbshipit-source-id: e1822ee5c575cb8786b395c1bc7550890b38a60d
1 parent 3e6fa77 commit 79736ff

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

aten/src/ATen/native/cpu/BinaryOpsKernel.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,26 +76,16 @@ void div_kernel(TensorIterator& iter) {
7676
return a / b;
7777
});
7878
});
79-
} else if (isComplexType(iter.dtype())) {
80-
AT_DISPATCH_COMPLEX_TYPES(iter.dtype(), "div_cpu", [&]() {
81-
cpu_kernel_vec(iter,
82-
[](scalar_t a, scalar_t b) __ubsan_ignore_float_divide_by_zero__ -> scalar_t {
83-
return a / b;
84-
},
85-
[](Vec256<scalar_t> a, Vec256<scalar_t> b) {
86-
return a / b;
87-
});
88-
});
89-
} else {
90-
AT_DISPATCH_FLOATING_TYPES_AND2(kBFloat16, kHalf, iter.dtype(), "div_cpu", [&]() {
91-
cpu_kernel_vec(iter,
92-
[=](scalar_t a, scalar_t b) __ubsan_ignore_float_divide_by_zero__ -> scalar_t {
93-
return a / b;
94-
},
95-
[=](Vec256<scalar_t> a, Vec256<scalar_t> b) {
96-
return a / b;
97-
});
98-
});
79+
} else {
80+
AT_DISPATCH_FLOATING_AND_COMPLEX_TYPES_AND2(kBFloat16, kHalf, iter.dtype(), "div_cpu", [&]() {
81+
cpu_kernel_vec(iter,
82+
[](scalar_t a, scalar_t b) __ubsan_ignore_float_divide_by_zero__ -> scalar_t {
83+
return a / b;
84+
},
85+
[](Vec256<scalar_t> a, Vec256<scalar_t> b) {
86+
return a / b;
87+
});
88+
});
9989
}
10090
}
10191

0 commit comments

Comments
 (0)