operation.hpp 961 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_OPERAND_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_OPERAND_HPP
Paul's avatar
Paul committed
3
4
5
6
7
8

#include <string>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
Paul's avatar
Paul committed
9
10
11
#include <migraph/shape.hpp>
#include <migraph/argument.hpp>
#include <migraph/context.hpp>
Paul's avatar
Paul committed
12

Paul's avatar
Paul committed
13
namespace migraph {
Paul's avatar
Paul committed
14

Paul's avatar
Paul committed
15
16
namespace operation_stream {

Paul's avatar
Paul committed
17
18
template <class T>
auto operator<<(std::ostream& os, const T& x) -> decltype(os << x.name())
Paul's avatar
Paul committed
19
{
Paul's avatar
Paul committed
20
    return os << x.name();
Paul's avatar
Paul committed
21
22
}

Paul's avatar
Paul committed
23
} // namespace operation_stream
Paul's avatar
Paul committed
24

25
<%
Paul's avatar
Paul committed
26
27
28
interface('operation',
    virtual('name', returns='std::string', const=True),
    virtual('compute_shape', returns='shape', input='std::vector<shape>', const=True),
Paul's avatar
Paul committed
29
    virtual('compute', returns='argument', ctx='context&', output='shape', input='std::vector<argument>', const=True),
Paul's avatar
Paul committed
30
    friend('operator<<', returns='std::ostream &', os='std::ostream &', op='const operation &', using='migraph::operation_stream::operator<<')
Paul's avatar
Paul committed
31
)
32
%>
Paul's avatar
Paul committed
33

Paul's avatar
Paul committed
34
} // namespace migraph
Paul's avatar
Paul committed
35
36

#endif