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.

opr_header_prologue.h 1.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // intentional no header guard here
  2. #include "megdnn/handle.h"
  3. #include "megdnn/opr_param_defs.h"
  4. #include "megdnn/opr_result_defs.h"
  5. #include "megdnn/oprs/base.h"
  6. #include "./visibility_prologue.h"
  7. #include <array>
  8. #include <limits>
  9. #ifndef _megdnn_in
  10. #define _megdnn_in
  11. #endif
  12. #ifndef _megdnn_out
  13. #define _megdnn_out
  14. #endif
  15. #ifndef _megdnn_tensor_in
  16. #define _megdnn_tensor_in const TensorND&
  17. #endif
  18. #ifndef _megdnn_tensor_out
  19. #define _megdnn_tensor_out const TensorND&
  20. #endif
  21. #ifndef _megdnn_tensor_inout
  22. #define _megdnn_tensor_inout const TensorND&
  23. #endif
  24. #ifndef _megdnn_workspace
  25. #define _megdnn_workspace const Workspace&
  26. #endif
  27. #define DEF_OPR_IMPL_CTOR(_opr_name, _base_name) \
  28. public: \
  29. _opr_name(Handle* handle) : _base_name(handle) {}
  30. #define DEF_OPR_IMPL(_opr_name, _base_name, _nr_inputs, _nr_outputs) \
  31. DEF_OPR_IMPL_CTOR(_opr_name, _base_name) \
  32. static MEGDNN_CONSTEXPR int NR_INPUTS = _nr_inputs; \
  33. static MEGDNN_CONSTEXPR int NR_OUTPUTS = _nr_outputs;
  34. #define DEF_OPR_PARAM(_pname) \
  35. public: \
  36. using Param = param::_pname; \
  37. Param& param() { return m_param; } \
  38. const Param& param() const { return m_param; } \
  39. \
  40. protected: \
  41. Param m_param
  42. // vim: syntax=cpp.doxygen