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.

images2neibs.cpp 1.1 kB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * \file src/opr/impl/dnn/images2neibs.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 "megbrain/opr/dnn/images2neibs.h"
  12. #include "megbrain/graph/grad_impl.h"
  13. #include "../internal/megdnn_opr_wrapper.inl"
  14. using namespace mgb;
  15. using namespace opr;
  16. MGB_DYN_TYPE_OBJ_FINAL_IMPL(Images2NeibsForward);
  17. MEGDNN_OPR_INIT1(Images2NeibsForward, "images2neibs")
  18. #if MGB_ENABLE_GRAD
  19. MGB_IMPL_OPR_GRAD(Images2NeibsForward) {
  20. mgb_assert(wrt_idx == 0 && out_grad.size() == 2 && !out_grad[1]);
  21. return Images2NeibsBackward::make(out_grad[0], opr.input(0), opr.param()).node();
  22. }
  23. #endif
  24. MGB_DYN_TYPE_OBJ_FINAL_IMPL(Images2NeibsBackward);
  25. MEGDNN_OPR_INIT2(Images2NeibsBackward, "images2neibs_grad", 1, false);
  26. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}