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.6 kB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * \file dnn/src/naive/lstm_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/lstm_cell/opr_impl.h"
  12. #include "src/common/lstm_cell.h"
  13. namespace megdnn {
  14. namespace naive {
  15. size_t LSTMCellImpl::get_workspace_in_bytes(
  16. const TensorLayout& input, const TensorLayout& weight_ih,
  17. const TensorLayout& bias_ih, const TensorLayout& hx,
  18. const TensorLayout& weight_hh, const TensorLayout& bias_hh,
  19. const TensorLayout& cx, const TensorLayout& h_new, const TensorLayout& c_new,
  20. const TensorLayout& gates) {
  21. return megdnn::lstm_cell::get_workspace_in_bytes(
  22. input, weight_ih, bias_ih, hx, weight_hh, bias_hh, cx, h_new, c_new, gates,
  23. handle());
  24. }
  25. void LSTMCellImpl::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_in cx, _megdnn_tensor_out h_new, _megdnn_tensor_out c_new,
  29. _megdnn_tensor_out gates, _megdnn_workspace workspace) {
  30. megdnn::lstm_cell::exec(
  31. input, weight_ih, bias_ih, hx, weight_hh, bias_hh, cx, h_new, c_new, gates,
  32. workspace, handle());
  33. }
  34. } // namespace naive
  35. } // namespace megdnn