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_impl.cpp 1.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * \file dnn/src/naive/rnn_cell/opr_impl.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, software
  8. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  9. * ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #include "src/naive/rnn_cell/opr_impl.h"
  12. #include "src/common/rnn_cell.h"
  13. #include "midout.h"
  14. MIDOUT_DECL(megdnn_naive_rnncell_fwd)
  15. namespace megdnn {
  16. namespace naive {
  17. size_t RNNCellImpl::get_workspace_in_bytes(
  18. const TensorLayout& input, const TensorLayout& weight_ih,
  19. const TensorLayout& bias_ih, const TensorLayout& hx,
  20. const TensorLayout& weight_hh, const TensorLayout& bias_hh,
  21. const TensorLayout& dst) {
  22. return megdnn::rnn_cell::get_workspace_in_bytes(
  23. input, weight_ih, bias_ih, hx, weight_hh, bias_hh, dst, handle());
  24. }
  25. void RNNCellImpl::exec(
  26. _megdnn_tensor_in input, _megdnn_tensor_in weight_ih, _megdnn_tensor_in bias_ih,
  27. _megdnn_tensor_in hx, _megdnn_tensor_in weight_hh, _megdnn_tensor_in bias_hh,
  28. _megdnn_tensor_out dst, _megdnn_workspace workspace) {
  29. MIDOUT_BEGIN(megdnn_naive_rnncell_fwd) {
  30. megdnn::rnn_cell::exec(
  31. input, weight_ih, bias_ih, hx, weight_hh, bias_hh, dst, workspace,
  32. param().nonlineMode, handle());
  33. }
  34. MIDOUT_END();
  35. }
  36. } // namespace naive
  37. } // namespace megdnn