"mmdet3d/evaluation/metrics/__init__.py" did not exist on "d78f097c823c09185e4f487578e766f0653a3f6e"
context.hpp 1.24 KB
Newer Older
Paul's avatar
Paul committed
1
2
#ifndef MIGRAPHX_GUARD_CONTEXT_HPP
#define MIGRAPHX_GUARD_CONTEXT_HPP
Paul's avatar
Paul committed
3

Paul's avatar
Paul committed
4
#include <cassert>
Paul's avatar
Paul committed
5
6
7
8
9
#include <string>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
Paul's avatar
Paul committed
10
#include <migraphx/config.hpp>
Shucai Xiao's avatar
Shucai Xiao committed
11
#include <migraphx/value.hpp>
Paul's avatar
Paul committed
12

Paul's avatar
Paul committed
13
namespace migraphx {
Paul's avatar
Paul committed
14
inline namespace MIGRAPHX_INLINE_NS {
Paul's avatar
Paul committed
15

Paul's avatar
Paul committed
16
17
18
19
20
21
#ifdef DOXYGEN

/// A context is used to store internal data for a `target`. A context is
/// constructed by a target during compilation and passed to the operations
/// during `eval`.
struct context
Paul's avatar
Paul committed
22
{
Paul's avatar
Paul committed
23
24
    /// Wait for any tasks in the context to complete
    void finish() const;
Paul's avatar
Paul committed
25
};
Paul's avatar
Paul committed
26
27
28

#else

Shucai Xiao's avatar
Shucai Xiao committed
29
30
31
32
33
34
35
36
37
template <class T>
value to_value_context(const T&)
{
    return value{};
}

template <class T>
void from_value_context(T&, const value&){}

Paul's avatar
Paul committed
38
<%
Shucai Xiao's avatar
Shucai Xiao committed
39
40
41
42
43
44
45
46
47
48
 interface('context',
           virtual('to_value', returns = 'value', const = True, default = 'to_value_context'),
           virtual('from_value', v = 'const value&', default = 'from_value_context'),
           virtual('finish', returns = 'void', const = True)) %>

    inline void migraphx_to_value(value& v, const context& ctx)
{
    v = ctx.to_value();
}
inline void migraphx_from_value(const value& v, context& ctx) { ctx.from_value(v); }
Paul's avatar
Paul committed
49

Paul's avatar
Paul committed
50
51
#endif

Paul's avatar
Paul committed
52
} // namespace MIGRAPHX_INLINE_NS
Paul's avatar
Paul committed
53
} // namespace migraphx
Paul's avatar
Paul committed
54
55

#endif