未验证 提交 cf780097 编写于 作者: L Leo Chen 提交者: GitHub

fix gcc warning of [-Wint-in-bool-context] (#42268)

上级 3d6fb260
......@@ -360,6 +360,14 @@ struct MulGradDX {
HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return dout * y; }
};
// avoid [-Wint-in-bool-context] warning
template <>
struct MulGradDX<bool> {
HOSTDEVICE bool operator()(bool x, bool y, bool out, bool dout) const {
return dout && y;
}
};
template <typename T>
struct MulGradDX<phi::dtype::complex<T>> {
HOSTDEVICE phi::dtype::complex<T> operator()(
......@@ -383,6 +391,14 @@ struct MulGradDY {
HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return dout * x; }
};
// avoid [-Wint-in-bool-context] warning
template <>
struct MulGradDY<bool> {
HOSTDEVICE bool operator()(bool x, bool y, bool out, bool dout) const {
return dout && x;
}
};
template <typename T>
struct MulGradDY<phi::dtype::complex<T>> {
HOSTDEVICE phi::dtype::complex<T> operator()(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册