blace.ai
Loading...
Searching...
No Matches
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:
42 GraphEvaluator(blace::ops::OpP node, bool is_in_worker = false);
43
49 void to_dot_file(const std::filesystem::path &filename);
50
55 std::string to_dot_string();
56
57#ifdef BLACE_AI_OPENCV_INTERFACE
63 std::pair<ml_core::ReturnCode, cv::Mat> evaluateToCVMat();
64#endif
65
71 std::pair<ml_core::ReturnCode, std::string> evaluateToString();
72
78 std::pair<ml_core::ReturnCode, std::vector<int64_t>> evaluateToIntList();
79
85 std::pair<ml_core::ReturnCode, std::shared_ptr<RawMemoryObject>>
87 std::shared_ptr<ml_core::ProgressCallback> progress_callback = nullptr);
88
89#ifdef BLACE_AI_TORCH_INTERFACE
95 bool has_all_required_data();
96
102 std::vector<int64_t> missing_data_frames();
103
104 // at::Tensor evaluateToTorchTensor(
105 // std::shared_ptr<ml_core::ProgressCallback> progress_callback =
106 // nullptr);
107 std::pair<ml_core::ReturnCode, at::Tensor> evaluateToTorchTensor(
108 std::shared_ptr<ml_core::ProgressCallback> progress_callback = nullptr);
109#endif
110
112
113private:
114 std::unique_ptr<GraphEvaluatorImpl> _impl;
115 bool is_in_worker;
116};
117} // namespace computation_graph
118} // namespace blace
Definition graph_evaluator.h:34
GraphEvaluator(blace::ops::OpP node, bool is_in_worker=false)
std::pair< ml_core::ReturnCode, std::vector< int64_t > > evaluateToIntList()
void to_dot_file(const std::filesystem::path &filename)
std::pair< ml_core::ReturnCode, std::shared_ptr< RawMemoryObject > > evaluateToRawMemory(std::shared_ptr< ml_core::ProgressCallback > progress_callback=nullptr)
std::pair< ml_core::ReturnCode, std::string > evaluateToString()
Contains implementation for a class used to I/O custom memory.