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.

fill.h 1.0 kB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * \file dnn/test/common/fill.h
  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. #pragma once
  12. #include "megdnn/handle.h"
  13. #include "megdnn/oprs/general.h"
  14. #include "src/common/opr_trait.h"
  15. #include "test/common/checker.h"
  16. namespace megdnn {
  17. namespace test {
  18. namespace fill {
  19. inline void run_fill_test(Handle* handle, DType dtype) {
  20. Checker<Fill> checker(handle);
  21. for (float value : {-1.23, 0.0, 0.001, 234.0, 2021.072}) {
  22. checker.set_param({value});
  23. checker.set_dtype(0, dtype);
  24. checker.exec(TensorShapeArray{{1, 1}});
  25. checker.exec(TensorShapeArray{{2, 3, 4}});
  26. }
  27. }
  28. } // namespace fill
  29. } // namespace test
  30. } // namespace megdnn
  31. // vim: syntax=cpp.doxygen