xref: /aosp_15_r20/external/pytorch/test/cpp/lite_interpreter_runtime/resources.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <string>
4 
5 namespace torch {
6 namespace testing {
7 
8 namespace detail {
9 class Path;
10 }
11 
12 /// Gets the path to the resource identified by name.
13 ///
14 /// @param name identifies a resource, relative path starting from the
15 ///             repo root
16 inline auto getResourcePath(std::string name) -> detail::Path;
17 
18 // End interface: implementation details follow.
19 
20 namespace detail {
21 
22 class Path {
23  public:
Path(std::string rep)24   explicit Path(std::string rep) : rep_(std::move(rep)) {}
25 
26   auto string() const -> std::string const& {
27     return rep_;
28   }
29 
30  private:
31   std::string rep_;
32 };
33 
34 } // namespace detail
35 
36 inline auto getResourcePath(std::string name) -> detail::Path {
37   return detail::Path(std::move(name));
38 }
39 
40 } // namespace testing
41 } // namespace torch
42