You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

check_non_finite.cpp 1.1 kB

12345678910111213141516171819202122232425262728293031
  1. #include "megdnn/oprs.h"
  2. #include "test/common/checker.h"
  3. #include "test/cuda/fixture.h"
  4. namespace megdnn {
  5. namespace test {
  6. TEST_F(CUDA, CHECK_NON_FINITE_BASIC) {
  7. Checker<CheckNonFinite> checker(handle_cuda());
  8. checker.set_allow_invalid_check(true);
  9. const auto inf = std::numeric_limits<float>::infinity();
  10. const auto nan = std::numeric_limits<float>::quiet_NaN();
  11. UniformFloatWithValueRNG rng(-1.0f, 1.0f, 0.1f, inf);
  12. checker.set_rng(0, &rng);
  13. //! while deduce layout, dst tensor dtype will be set to Int32
  14. checker.execs({{512 * 4}, {4}, {}});
  15. rng = UniformFloatWithValueRNG(-1.0f, 1.0f, 1.f, inf);
  16. checker.set_rng(0, &rng);
  17. checker.execs({{4}, {512 * 4}, {}});
  18. rng = UniformFloatWithValueRNG(-1.0f, 1.0f, 1.f, nan);
  19. checker.set_rng(0, &rng);
  20. checker.execs({{32}, {256}, {}});
  21. rng = UniformFloatWithValueRNG(-1.0f, 1.0f, 0.f, nan);
  22. checker.set_rng(0, &rng);
  23. checker.execs({{16}, {16}, {2}, {}});
  24. }
  25. } // namespace test
  26. } // namespace megdnn
  27. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}