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.

concat.cpp 1.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * \file dnn/test/fallback/concat.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/fallback/fixture.h"
  12. #include "test/common/checker.h"
  13. #include "test/common/task_record_check.h"
  14. namespace megdnn {
  15. namespace test {
  16. TEST_F(FALLBACK, CONCAT) {
  17. Checker<Concat> checker(handle());
  18. using Param = Concat::Param;
  19. for (auto dtype : std::vector<DType>{
  20. dtype::Float32(), dtype::Int32(), dtype::Int16(), dtype::Float16(),
  21. dtype::Int8(), dtype::Uint8()}) {
  22. for (size_t axis = 0; axis < 4; ++axis) {
  23. Param param;
  24. param.axis = axis;
  25. TensorShapeArray shapes(4, TensorShape({12, 13, 14, 15}));
  26. for (size_t i = 0; i < 4; ++i) {
  27. shapes[i].shape[axis] = i + 1;
  28. }
  29. shapes.emplace_back();
  30. for (size_t i = 0; i < shapes.size(); ++i)
  31. checker.set_dtype(i, dtype);
  32. checker.set_param(param).exec(shapes);
  33. }
  34. }
  35. }
  36. TEST_F(FALLBACK, CONCAT_RECORD) {
  37. TaskRecordChecker<Concat> checker(1);
  38. using Param = Concat::Param;
  39. Param param;
  40. param.axis = 0;
  41. TensorShapeArray shapes(4, TensorShape({12, 13, 14, 15}));
  42. for (size_t i = 0; i < 4; ++i) {
  43. shapes[i].shape[0] = i + 1;
  44. }
  45. shapes.emplace_back();
  46. for (size_t i = 0; i < shapes.size(); ++i)
  47. checker.set_dtype(i, dtype::Float32());
  48. checker.set_param(param).exec(shapes);
  49. }
  50. } // namespace test
  51. } // namespace megdnn
  52. // vim: syntax=cpp.doxygen