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.

repeat.cpp 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * \file dnn/test/cuda/repeat.cpp
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #include "test/cuda/fixture.h"
  12. #include "test/common/checker.h"
  13. #include "test/common/tile_repeat.h"
  14. namespace megdnn {
  15. namespace test {
  16. TEST_F(CUDA, REPEAT_FORWARD) {
  17. Checker<RepeatForward> checker(handle_cuda());
  18. auto args = tile_repeat::get_args();
  19. for (auto&& arg : args) {
  20. checker.set_dtype(0, dtype::Float32())
  21. .set_param(arg.param())
  22. .execs({arg.src, {}});
  23. checker.set_dtype(0, dtype::Float16())
  24. .set_param(arg.param())
  25. .execs({arg.src, {}});
  26. }
  27. }
  28. TEST_F(CUDA, REPEAT_BACKWARD) {
  29. Checker<RepeatBackward> checker(handle_cuda());
  30. UniformFloatRNG rng(1, 2);
  31. checker.set_epsilon(1e-2).set_rng(0, &rng);
  32. ;
  33. auto args = tile_repeat::get_args();
  34. for (auto&& arg : args) {
  35. checker.set_dtype(0, dtype::Float32())
  36. .set_dtype(1, dtype::Float32())
  37. .set_param(arg.param())
  38. .execs({arg.dst, arg.src});
  39. checker.set_dtype(0, dtype::Float16())
  40. .set_dtype(1, dtype::Float16())
  41. .set_param(arg.param())
  42. .execs({arg.dst, arg.src});
  43. }
  44. }
  45. } // namespace test
  46. } // namespace megdnn
  47. // vim: syntax=cpp.doxygen