Skip to content

Commit

Permalink
fix variant compile error (PaddlePaddle#42203)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwhql committed Apr 25, 2022
1 parent ff14fc1 commit de8aa07
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions paddle/phi/kernels/cpu/where_grad_kernel.cc
Expand Up @@ -14,6 +14,8 @@

#include "paddle/phi/kernels/where_grad_kernel.h"

#include "paddle/phi/core/kernel_registry.h"

namespace phi {

template <typename T, typename Context>
Expand Down
2 changes: 2 additions & 0 deletions paddle/phi/kernels/cpu/where_kernel.cc
Expand Up @@ -14,6 +14,8 @@

#include "paddle/phi/kernels/where_kernel.h"

#include "paddle/phi/core/kernel_registry.h"

namespace phi {

template <typename T, typename Context>
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/kernels/funcs/activation_functor.h
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#pragma once

#include <glog/logging.h>
#include <algorithm>
#include <memory>
Expand All @@ -33,7 +34,6 @@
#include "paddle/phi/common/float16.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/eigen/common.h"
#include "paddle/phi/kernels/funcs/eigen/extensions.h"

Expand Down
3 changes: 3 additions & 0 deletions paddle/phi/kernels/gpu/where_grad_kernel.cu
Expand Up @@ -14,6 +14,9 @@

#include "paddle/phi/kernels/where_grad_kernel.h"

#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/kernel_registry.h"

namespace phi {

template <typename T>
Expand Down
2 changes: 2 additions & 0 deletions paddle/phi/kernels/gpu/where_kernel.cu
Expand Up @@ -14,6 +14,8 @@

#include "paddle/phi/kernels/where_kernel.h"

#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/funcs/elementwise_functor.h"

Expand Down
3 changes: 0 additions & 3 deletions paddle/phi/kernels/where_grad_kernel.h
Expand Up @@ -14,10 +14,7 @@

#pragma once

#include "paddle/phi/backends/all_context.h"
#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/kernel_registry.h"

namespace phi {

Expand Down
3 changes: 0 additions & 3 deletions paddle/phi/kernels/where_kernel.h
Expand Up @@ -14,10 +14,7 @@

#pragma once

#include "paddle/phi/backends/all_context.h"
#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/kernel_registry.h"

namespace phi {

Expand Down
3 changes: 2 additions & 1 deletion paddle/utils/variant.h
Expand Up @@ -2691,7 +2691,8 @@ inline constexpr bool all(std::initializer_list<bool> bs) {

template <typename Visitor, typename... Vs>
inline constexpr decltype(auto) visit(Visitor &&visitor, Vs &&... vs) {
return (detail::all({!vs.valueless_by_exception()...})
return (detail::all(
lib::array<bool, sizeof...(Vs)>{!vs.valueless_by_exception()...})
? (void)0
: throw_bad_variant_access()),
detail::visitation::variant::visit_value(
Expand Down

0 comments on commit de8aa07

Please sign in to comment.