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.

workspace_wrapper.h 955 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * \file dnn/test/common/workspace_wrapper.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/basic_types.h"
  13. #include "megdnn/handle.h"
  14. namespace megdnn {
  15. namespace test {
  16. class WorkspaceWrapper {
  17. public:
  18. WorkspaceWrapper();
  19. WorkspaceWrapper(Handle* handle, size_t size_in_bytes = 0);
  20. ~WorkspaceWrapper();
  21. void update(size_t size_in_bytes);
  22. bool valid() const { return m_handle != nullptr; }
  23. Workspace workspace() const { return m_workspace; }
  24. private:
  25. Handle* m_handle;
  26. Workspace m_workspace;
  27. };
  28. } // namespace test
  29. } // namespace megdnn
  30. // vim: syntax=cpp.doxygen