"vscode:/vscode.git/clone" did not exist on "612a20410f9decc43e46d9fbb0f7dc92d96521a0"
builtin.hpp 1.15 KB
Newer Older
Paul's avatar
Paul committed
1
2
#ifndef MIGRAPH_GUARD_BUILTIN_HPP
#define MIGRAPH_GUARD_BUILTIN_HPP
Paul's avatar
Paul committed
3

Paul's avatar
Paul committed
4
5
#include <migraph/context.hpp>
#include <migraph/errors.hpp>
Paul's avatar
Paul committed
6
#include <migraph/argument.hpp>
Paul's avatar
Paul committed
7

Paul's avatar
Paul committed
8
namespace migraph {
Paul's avatar
Paul committed
9
10
11

namespace builtin {

Paul's avatar
Paul committed
12
13
struct literal
{
Paul's avatar
Paul committed
14
    std::string name() const { return "@literal"; }
Paul's avatar
Paul committed
15
16
    shape compute_shape(std::vector<shape>) const { MIGRAPH_THROW("builtin"); }
    argument compute(context&, shape, std::vector<argument>) const { MIGRAPH_THROW("builtin"); }
Paul's avatar
Paul committed
17
18
};

Paul's avatar
Paul committed
19
20
21
22
struct outline
{
    shape s;
    std::string name() const { return "@outline"; }
Paul's avatar
Paul committed
23
    shape compute_shape(std::vector<shape>) const { return s; }
Paul's avatar
Paul committed
24
    argument compute(context&, shape, std::vector<argument>) const { MIGRAPH_THROW("builtin"); }
Paul's avatar
Paul committed
25
26
};

Paul's avatar
Paul committed
27
28
29
struct param
{
    std::string parameter;
Paul's avatar
Paul committed
30
    std::string name() const { return "@param"; }
Paul's avatar
Paul committed
31
32
    shape compute_shape(std::vector<shape>) const { MIGRAPH_THROW("builtin"); }
    argument compute(context&, shape, std::vector<argument>) const { MIGRAPH_THROW("builtin"); }
Paul's avatar
Paul committed
33
    friend std::ostream& operator<<(std::ostream& os, const param& op)
Paul's avatar
Paul committed
34
    {
Paul's avatar
Paul committed
35
        os << op.name() << ":" << op.parameter;
Paul's avatar
Paul committed
36
37
        return os;
    }
Paul's avatar
Paul committed
38
};
Paul's avatar
Paul committed
39

Paul's avatar
Paul committed
40
} // namespace builtin
Paul's avatar
Paul committed
41

Paul's avatar
Paul committed
42
} // namespace migraph
Paul's avatar
Paul committed
43
44

#endif