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.

dct_ref.h 1.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * \file
  3. * dnn/test/common/dct_ref.h
  4. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  5. *
  6. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  7. *
  8. * Unless required by applicable law or agreed to in writing,
  9. * software distributed under the License is distributed on an
  10. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or
  11. * implied.
  12. */
  13. #pragma once
  14. #include <math.h>
  15. #include <vector>
  16. #include "megdnn/dtype.h"
  17. #include "megdnn/oprs/nn.h"
  18. #include "test/common/checker.h"
  19. #include "test/common/opr_proxy.h"
  20. #include "test/common/rng.h"
  21. namespace megdnn {
  22. namespace test {
  23. using Param = DctChannelSelectForward::Param;
  24. struct DctTestcase {
  25. using TensorValueArray = TensorNDArray;
  26. TensorValueArray testcase_in;
  27. TensorValueArray testcase_out;
  28. std::vector<uint8_t> inp_vec;
  29. std::vector<int> mask_offset_vec;
  30. std::vector<int> mask_val_vec;
  31. std::vector<float> output_vec;
  32. static std::shared_ptr<DctTestcase> make() {
  33. return std::make_shared<DctTestcase>();
  34. }
  35. };
  36. CheckerHelper::TensorsConstriant gen_dct_constriant(
  37. const size_t n, const size_t ic, const size_t ih, const size_t iw,
  38. const size_t oc, Param param);
  39. std::shared_ptr<DctTestcase> gen_dct_case(
  40. const size_t n, const size_t ic, const size_t ih, const size_t iw,
  41. const size_t oc, Param param, DType dst_dtype = dtype::Float32(),
  42. bool correct_result = true);
  43. } // namespace test
  44. } // namespace megdnn
  45. // vim: syntax=cpp.doxygen