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.

lrn.cpp 1.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * \file dnn/test/cuda/lrn.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/local.h"
  14. namespace megdnn {
  15. namespace test {
  16. TEST_F(CUDA, LRN_FORWARD) {
  17. Checker<LRNForward> checker(handle_cuda());
  18. for (auto dtype : std::vector<DType>{dtype::Float32(), dtype::Float16()}) {
  19. checker.set_dtype(0, dtype);
  20. checker.execs({{2, 11, 12, 13}, {}});
  21. for (size_t w = 10; w <= 50; ++w) {
  22. checker.execs({{2, w, 12, 13}, {}});
  23. }
  24. }
  25. }
  26. TEST_F(CUDA, LRN_BACKWARD) {
  27. Checker<LRNBackward> checker(handle_cuda());
  28. auto shape = TensorShape{2, 11, 12, 13};
  29. checker.set_dtype(0, dtype::Float32());
  30. checker.exec(TensorShapeArray{shape, shape, shape, shape});
  31. checker.set_dtype(1, dtype::Float32());
  32. checker.exec(TensorShapeArray{shape, shape, shape, shape});
  33. }
  34. } // namespace test
  35. } // namespace megdnn
  36. // vim: syntax=cpp.doxygen