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::optional<cv::Mat> evaluateToCVMat();
64#endif
65
71 std::optional<std::string> evaluateToString();
72
78 std::optional<std::vector<int64_t>> evaluateToIntList();
79
85 std::optional<std::shared_ptr<RawMemoryObject>> evaluateToRawMemory(
86 std::shared_ptr<ml_core::ProgressCallback> progress_callback = nullptr);
87
88#ifdef BLACE_AI_TORCH_INTERFACE
94 bool has_all_required_data();
95
101 std::vector<int64_t> missing_data_frames();
102
103 // at::Tensor evaluateToTorchTensor(
104 // std::shared_ptr<ml_core::ProgressCallback> progress_callback =
105 // nullptr);
106 std::optional<at::Tensor> evaluateToTorchTensor(
107 std::shared_ptr<ml_core::ProgressCallback> progress_callback = nullptr);
108#endif
109
111
112private:
113 std::unique_ptr<GraphEvaluatorImpl> _impl;
114 bool is_in_worker;
115};
116} // namespace computation_graph
117} // namespace blace
Definition graph_evaluator.h:34
std::optional< std::shared_ptr< RawMemoryObject > > evaluateToRawMemory(std::shared_ptr< ml_core::ProgressCallback > progress_callback=nullptr)
GraphEvaluator(blace::ops::OpP node, bool is_in_worker=false)
std::optional< std::vector< int64_t > > evaluateToIntList()
void to_dot_file(const std::filesystem::path &filename)
std::optional< std::string > evaluateToString()
Contains implementation for a class used to I/O custom memory.