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.

oprs.h 2.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * \file dnn/include/megdnn/oprs.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/oprs/cv.h"
  13. #include "megdnn/oprs/general.h"
  14. #include "megdnn/oprs/imgproc.h"
  15. #include "megdnn/oprs/linalg.h"
  16. #include "megdnn/oprs/nn.h"
  17. #include "megdnn/oprs/nn_int.h"
  18. #include "megdnn/oprs/utils.h"
  19. template <typename Opr>
  20. struct OprArityTrait;
  21. template <typename Opr, int _arity_in, int _arity_out>
  22. struct OprArityTraitTmpl {
  23. static constexpr int arity_in = _arity_in;
  24. static constexpr int arity_out = _arity_out;
  25. static constexpr int arity = arity_in + arity_out;
  26. };
  27. #define INST_ARITY(_Opr, _in, _out) \
  28. template <> \
  29. struct OprArityTrait<_Opr> : public OprArityTraitTmpl<_Opr, _in, _out> {};
  30. INST_ARITY(megdnn::ConvolutionBackwardData, 2, 1);
  31. INST_ARITY(megdnn::ConvolutionBackwardFilter, 2, 1);
  32. INST_ARITY(megdnn::Convolution3DForward, 2, 1);
  33. INST_ARITY(megdnn::Convolution3DBackwardData, 2, 1);
  34. INST_ARITY(megdnn::Convolution3DBackwardFilter, 2, 1);
  35. INST_ARITY(megdnn::LocalShareForward, 2, 1);
  36. INST_ARITY(megdnn::LocalShareBackwardData, 2, 1);
  37. INST_ARITY(megdnn::LocalShareBackwardFilter, 2, 1);
  38. INST_ARITY(megdnn::Convolution, 2, 1);
  39. INST_ARITY(megdnn::DeformableConvForward, 4, 1);
  40. INST_ARITY(megdnn::DeformableConvBackwardFilter, 4, 1);
  41. INST_ARITY(megdnn::BatchConvBiasForward, 4, 1);
  42. INST_ARITY(megdnn::ConvBias, 4, 1);
  43. INST_ARITY(megdnn::DeformableConvBackwardData, 5, 3);
  44. INST_ARITY(megdnn::MatrixMul, 2, 1);
  45. INST_ARITY(megdnn::BatchedMatrixMul, 2, 1);
  46. INST_ARITY(megdnn::PoolingForward, 1, 1);
  47. INST_ARITY(megdnn::PoolingBackward, 3, 1);
  48. #undef INST_ARITY
  49. // vim: syntax=cpp.doxygen

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台