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.

linspace.cpp 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * \file dnn/test/cuda/linspace.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 "megdnn/oprs.h"
  13. #include "test/common/checker.h"
  14. namespace megdnn {
  15. namespace test {
  16. TEST_F(CUDA, LINSPACE) {
  17. Checker<Linspace> checker(handle_cuda());
  18. Linspace::Param param;
  19. param.start = 0.5;
  20. param.stop = 1.5;
  21. param.endpoint = true;
  22. for (DType dtype :
  23. std::vector<DType>{dtype::Float16(), dtype::Int32(), dtype::Float32()}) {
  24. checker.set_dtype(0, dtype).set_param(param).exec(TensorShapeArray{{11}});
  25. }
  26. param.endpoint = false;
  27. for (DType dtype :
  28. std::vector<DType>{dtype::Float16(), dtype::Int32(), dtype::Float32()}) {
  29. checker.set_dtype(0, dtype).set_param(param).exec(TensorShapeArray{{11}});
  30. }
  31. }
  32. } // namespace test
  33. } // namespace megdnn
  34. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}