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.4 kB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "test/naive/fixture.h"
  2. #include "megdnn/oprs.h"
  3. #include "test/common/checker.h"
  4. namespace megdnn {
  5. namespace test {
  6. TEST_F(NAIVE, CHECK_NON_FINITE_BASIC) {
  7. Checker<CheckNonFinite> checker(handle(), false);
  8. checker.exect(
  9. Testcase{
  10. TensorValue({4}, dtype::Float32(), {1.1, 2.2, 3.3, 4.3}),
  11. TensorValue({4}, dtype::Float32(), {1.1, 2.2, 3.3, 4.3}),
  12. {}},
  13. Testcase{{}, {}, TensorValue({1}, dtype::Int32(), {0})});
  14. checker.exect(
  15. Testcase{
  16. TensorValue({4}, dtype::Float32(), {1.1, 2.2, 3.3, 4.3}),
  17. TensorValue(
  18. {4}, dtype::Float32(),
  19. {1.1f, 2.2f, 3.3f, std::numeric_limits<float>::infinity()}),
  20. {}},
  21. Testcase{{}, {}, TensorValue({1}, dtype::Int32(), {1})});
  22. checker.exect(
  23. Testcase{
  24. TensorValue({4}, dtype::Float32(), {1.1, 2.2, 3.3, 4.3}),
  25. TensorValue(
  26. {4}, dtype::Float32(),
  27. {1.1f, 2.2f, 3.3f,
  28. std::numeric_limits<float>::quiet_NaN()}),
  29. {}},
  30. Testcase{{}, {}, TensorValue({1}, dtype::Int32(), {1})});
  31. }
  32. } // namespace test
  33. } // namespace megdnn
  34. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}