blace.ai
graph_evaluator.h
Go to the documentation of this file.
1#pragma once
3#include "library_defines.h"
4#include "ml_core/callbacks.h"
5#include "public_ops.h"
6#ifdef BLACE_AI_TORCH_INTERFACE
7#include <ATen/core/TensorBody.h>
8#endif
9#include <filesystem>
10#include <memory>
11#ifdef BLACE_AI_OPENCV_INTERFACE
12#include <opencv2/core/mat.hpp>
13#endif
14
20namespace blace {
21class NodeOp;
22}
23
24namespace blace {
25namespace computation_graph {
29struct GraphEvaluatorImpl;
30
34class EXPORT_OR_IMPORT GraphEvaluator {
35public:
41 GraphEvaluator(blace::ops::OpP node);
42
48 GraphEvaluator(std::shared_ptr<NodeOp> node);
49
55 void to_dot_file(const std::filesystem::path &filename);
56
62 std::string to_dot_string();
63
64#ifdef BLACE_AI_OPENCV_INTERFACE
70 std::optional<cv::Mat> evaluateToCVMat();
71#endif
72
78 std::optional<std::string> evaluateToString();
79
85 std::optional<std::vector<int64_t>> evaluateToIntList();
86
92 std::optional<RawMemoryObject> evaluateToRawMemory(
93 std::shared_ptr<ml_core::ProgressCallback> progress_callback = nullptr);
94
95#ifdef BLACE_AI_TORCH_INTERFACE
101 std::optional<at::Tensor> evaluateToTorchTensor(
102 std::shared_ptr<ml_core::ProgressCallback> progress_callback = nullptr);
103#endif
104
106
107private:
108 std::unique_ptr<GraphEvaluatorImpl> _impl;
109};
110} // namespace computation_graph
111} // namespace blace
Definition: graph_evaluator.h:34
std::optional< std::vector< int64_t > > evaluateToIntList()
std::optional< RawMemoryObject > evaluateToRawMemory(std::shared_ptr< ml_core::ProgressCallback > progress_callback=nullptr)
void to_dot_file(const std::filesystem::path &filename)
std::optional< std::string > evaluateToString()
GraphEvaluator(std::shared_ptr< NodeOp > node)
Contains implementation for a class used to I/O custom memory.