2021-12-07 10:57:55 +08:00
|
|
|
// Copyright (c) OpenMMLab. All rights reserved.
|
|
|
|
|
|
|
|
#ifndef MMDEPLOY_SRC_EXPERIMENTAL_PIPELINE_IR_H_
|
|
|
|
#define MMDEPLOY_SRC_EXPERIMENTAL_PIPELINE_IR_H_
|
|
|
|
|
|
|
|
#include "core/model.h"
|
|
|
|
#include "core/module.h"
|
|
|
|
#include "core/registry.h"
|
|
|
|
#include "core/status_code.h"
|
2022-06-01 14:10:43 +08:00
|
|
|
#include "execution/schedulers/registry.h"
|
2021-12-07 10:57:55 +08:00
|
|
|
#include "mpl/span.h"
|
|
|
|
#include "utils/formatter.h"
|
|
|
|
|
2022-02-24 20:08:44 +08:00
|
|
|
namespace mmdeploy {
|
|
|
|
|
|
|
|
namespace graph {
|
2021-12-07 10:57:55 +08:00
|
|
|
|
|
|
|
using std::pair;
|
|
|
|
using std::string;
|
|
|
|
using std::unique_ptr;
|
|
|
|
using std::vector;
|
|
|
|
|
2022-06-01 14:10:43 +08:00
|
|
|
template <class... Ts>
|
|
|
|
using Sender = TypeErasedSender<Ts...>;
|
2021-12-07 10:57:55 +08:00
|
|
|
|
2022-06-01 14:10:43 +08:00
|
|
|
class MMDEPLOY_API Node {
|
|
|
|
friend class NodeParser;
|
2021-12-07 10:57:55 +08:00
|
|
|
|
|
|
|
public:
|
2022-06-01 14:10:43 +08:00
|
|
|
virtual ~Node() = default;
|
|
|
|
virtual Sender<Value> Process(Sender<Value> input) = 0;
|
|
|
|
const vector<string>& inputs() const noexcept { return inputs_; }
|
|
|
|
const vector<string>& outputs() const noexcept { return outputs_; }
|
|
|
|
const string& name() const noexcept { return name_; }
|
2021-12-07 10:57:55 +08:00
|
|
|
|
2022-06-01 14:10:43 +08:00
|
|
|
protected:
|
|
|
|
string name_;
|
|
|
|
vector<string> inputs_;
|
|
|
|
vector<string> outputs_;
|
2021-12-07 10:57:55 +08:00
|
|
|
};
|
|
|
|
|
2022-06-01 14:10:43 +08:00
|
|
|
class MMDEPLOY_API NodeParser {
|
2021-12-07 10:57:55 +08:00
|
|
|
public:
|
2022-06-01 14:10:43 +08:00
|
|
|
static Result<void> Parse(const Value& config, Node& node);
|
2021-12-07 10:57:55 +08:00
|
|
|
};
|
|
|
|
|
2022-02-24 20:08:44 +08:00
|
|
|
} // namespace graph
|
|
|
|
|
|
|
|
MMDEPLOY_DECLARE_REGISTRY(graph::Node);
|
|
|
|
|
|
|
|
} // namespace mmdeploy
|
2021-12-07 10:57:55 +08:00
|
|
|
|
|
|
|
#endif // MMDEPLOY_SRC_EXPERIMENTAL_PIPELINE_IR_H_
|