Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【paddle_test No.28】replace parts of cc_test with paddle_test #61676

Merged
merged 23 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions paddle/fluid/eager/nan_inf_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,42 @@ using TupleOfSixTensors =
using TupleOfTensorAndVector =
std::tuple<Tensor, std::vector<Tensor>, std::vector<Tensor>>;

void CheckTensorHasNanOrInf(const std::string& api_name, const Tensor& tensor);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const Tensor& tensor);

void CheckTensorHasNanOrInf(const std::string& api_name,
const paddle::optional<Tensor>& tensor);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const paddle::optional<Tensor>& tensor);

void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfTwoTensors& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfTwoTensors& tensors);

void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfThreeTensors& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfThreeTensors& tensors);

void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfFourTensors& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfFourTensors& tensors);

void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfFiveTensors& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfFiveTensors& tensors);

void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfSixTensors& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfSixTensors& tensors);

void CheckTensorHasNanOrInf(const std::string& api_name,
const std::vector<Tensor>& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const std::vector<Tensor>& tensors);

void CheckTensorHasNanOrInf(
TEST_API void CheckTensorHasNanOrInf(
const std::string& api_name,
const paddle::optional<std::vector<Tensor>>& tensors);

void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfTensorAndVector& tensors);
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleOfTensorAndVector& tensors);

void SetCheckOpList(const std::string& check_op_list);

void SetSkipOpList(const std::string& skip_op_list);

void CheckTensorHasNanOrInf(
TEST_API void CheckTensorHasNanOrInf(
const std::string& api_name,
const paddle::small_vector<std::vector<paddle::Tensor>,
egr::kSlotSmallVectorSize>& tensors);
Expand All @@ -90,8 +91,8 @@ struct NanInfChecker<TupleT, N, N> {
};

template <typename TupleT>
void CheckTensorHasNanOrInf(const std::string& api_name,
const TupleT& tensors) {
TEST_API void CheckTensorHasNanOrInf(const std::string& api_name,
Liyulingyue marked this conversation as resolved.
Show resolved Hide resolved
const TupleT& tensors) {
constexpr size_t size = std::tuple_size<TupleT>::value;
NanInfChecker<TupleT, 0, size - 1>()(api_name, tensors);
}
Expand Down
5 changes: 1 addition & 4 deletions test/cpp/eager/task_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
cc_test(
test_egr_task_nan_inf_utils
SRCS nan_inf_utils_test.cc
DEPS eager_nan_inf_utils phi common)
paddle_test(test_egr_task_nan_inf_utils SRCS nan_inf_utils_test.cc DEPS common)

if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
cc_test(
Expand Down