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.

group_local.cpp 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * \file dnn/test/arm_common/group_local.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/arm_common/fixture.h"
  12. #include "test/common/benchmarker.h"
  13. #include "test/common/checker.h"
  14. #include "test/common/group_local.h"
  15. #include "test/common/task_record_check.h"
  16. #include "test/common/timer.h"
  17. namespace megdnn {
  18. namespace test {
  19. using Param = param::Convolution;
  20. TEST_F(ARM_COMMON, GROUP_LOCAL_FORWARD) {
  21. auto args = group_local::get_args();
  22. Checker<GroupLocalForward> checker(handle());
  23. for (auto&& arg : args) {
  24. checker.set_param(arg.param).execs({arg.sshape(), arg.fshape(), arg.dshape()});
  25. }
  26. NormalRNG rng(10.f);
  27. checker.set_rng(0, &rng).set_rng(1, &rng);
  28. args = group_local::get_args_for_fp16();
  29. #if __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
  30. for (auto&& arg : args) {
  31. checker.set_dtype(0, dtype::Float16())
  32. .set_dtype(1, dtype::Float16())
  33. .set_dtype(2, dtype::Float16());
  34. checker.set_epsilon(1e-2);
  35. checker.set_param(arg.param).execs({arg.sshape(), arg.fshape(), arg.dshape()});
  36. }
  37. #endif
  38. }
  39. TEST_F(ARM_COMMON, GROUP_LOCAL_FORWARD_RECORD) {
  40. auto args = group_local::get_args();
  41. TaskRecordChecker<GroupLocalForward> checker(0);
  42. for (auto&& arg : args) {
  43. checker.set_param(arg.param).execs({arg.sshape(), arg.fshape(), arg.dshape()});
  44. }
  45. NormalRNG rng(10.f);
  46. checker.set_rng(0, &rng).set_rng(1, &rng);
  47. args = group_local::get_args_for_fp16();
  48. #if __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
  49. for (auto&& arg : args) {
  50. checker.set_dtype(0, dtype::Float16())
  51. .set_dtype(1, dtype::Float16())
  52. .set_dtype(2, dtype::Float16());
  53. checker.set_epsilon(1e-2);
  54. checker.set_param(arg.param).execs({arg.sshape(), arg.fshape(), arg.dshape()});
  55. }
  56. #endif
  57. }
  58. } // namespace test
  59. } // namespace megdnn
  60. // vim: syntax=cpp.doxygen