blace.ai
public_ops.h
1#pragma once
2
3#include "blace_index.h"
4#include "computation_graph/public_base_op.h"
5#include "computation_graph/raw_memory_fetcher.h"
7#include "ml_core/types.h"
8#ifdef BLACE_AI_OPENCV_INTERFACE
9#include <opencv2/core/mat.hpp>
10#endif
11#include <variant>
12
13#include "library_defines.h"
14
15typedef std::vector<int64_t> SizesVec;
16
17namespace blace {
18namespace ops {
19
20#ifdef BLACE_AI_OPENCV_INTERFACE
24class EXPORT_OR_IMPORT FromCVMatOp : public BaseOp {
25public:
31 FromCVMatOp(cv::Mat cv_mat);
32};
33
37class EXPORT_OR_IMPORT FromImageFileOp : public BaseOp {
38public:
44 FromImageFileOp(std::string path);
45};
46
47#endif
48
52class EXPORT_OR_IMPORT Interpolate2DOp : public BaseOp {
53public:
64 Interpolate2DOp(OpP node, int height, int width,
65 ml_core::Interpolation interpolation, bool align_corners,
66 bool antialias);
67};
68
72class EXPORT_OR_IMPORT NormalizeImagenetOp : public BaseOp {
73public:
80};
81
85class EXPORT_OR_IMPORT FromTextOp : public BaseOp {
86public:
92 FromTextOp(std::string text);
93};
94
98class EXPORT_OR_IMPORT FromIntOp : public BaseOp {
99public:
105 FromIntOp(int val);
106};
107
111class EXPORT_OR_IMPORT FromIntListOp : public BaseOp {
112public:
118 FromIntListOp(std::vector<int64_t> val);
119};
120
124class EXPORT_OR_IMPORT FromBoolOp : public BaseOp {
125public:
131 FromBoolOp(bool val);
132};
133
137class EXPORT_OR_IMPORT FromFloatOp : public BaseOp {
138public:
144 FromFloatOp(float val);
145};
146
150class EXPORT_OR_IMPORT InferenceOp : public BaseOp {
151
152public:
163 InferenceOp(std::vector<char> model_bytes, std::vector<OpP> inputs,
164 ml_core::InferenceArgsCollection inference_args, int return_index,
165 std::string payload_folder);
166
173 ~InferenceOp();
174};
175
181class EXPORT_OR_IMPORT MapToRangeOp : public BaseOp {
182
183public:
191};
192
197class EXPORT_OR_IMPORT NormalizeToZeroOneOP : public BaseOp {
198
199public:
206
214 NormalizeToZeroOneOP(OpP input, double min, double max);
215
225 NormalizeToZeroOneOP(OpP input, OpP min_in, OpP max_in, double min_out,
226 double max_out);
227
237 NormalizeToZeroOneOP(OpP input, double min_in, double max_in, double min_out,
238 double max_out);
239
249 NormalizeToZeroOneOP(OpP input, double min_in, double max_in, OpP min_out,
250 OpP max_out);
258};
259
263class EXPORT_OR_IMPORT ToColorOp : public BaseOp {
264
265public:
273 ToColorOp(OpP input, ml_core::ColorFormatEnum color_format);
274
283 ToColorOp(OpP input, ml_core::ColorFormatEnum color_format,
284 ml_core::LAB_NORMS lab_norms);
285};
286
290class EXPORT_OR_IMPORT FromRawMemoryOp : public BaseOp {
291
292public:
300 FromRawMemoryOp(std::shared_ptr<blace::RawMemoryObject> mem_object);
301};
302
306class EXPORT_OR_IMPORT PrepareForHostCopyOP : public BaseOp {
307
308public:
324 ml_core::ColorFormatEnum color_format,
325 ml_core::OrderEnum tensor_order,
326 ml_core::ValueRangeEnum value_range,
327 ml_core::DeviceEnum device);
328};
329
333class EXPORT_OR_IMPORT ZerosOp : public BaseOp {
334
335public:
347 ZerosOp(std::vector<int64_t> sizes, ml_core::OrderEnum order,
349 ml_core::ColorFormatEnum color_format);
355 ZerosOp(ZerosOp const &e);
356 ~ZerosOp();
357};
358
362class EXPORT_OR_IMPORT OnesOp : public BaseOp {
363
364public:
376 OnesOp(std::vector<int64_t> sizes, ml_core::OrderEnum order,
378 ml_core::ColorFormatEnum color_format);
379};
380
384class EXPORT_OR_IMPORT IndexPutOp : public BaseOp {
385
386public:
395 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices,
396 blace::ops::OpP val);
405 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, double val);
414 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, float val);
423 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, int val);
424};
425
429class EXPORT_OR_IMPORT NoneOp : public BaseOp {
430
431public:
437};
438
439} // namespace ops
440} // namespace blace
Definition: public_ops.h:124
Definition: public_ops.h:137
Definition: public_ops.h:111
FromIntListOp(std::vector< int64_t > val)
Definition: public_ops.h:98
Definition: public_ops.h:290
FromRawMemoryOp(std::shared_ptr< blace::RawMemoryObject > mem_object)
Definition: public_ops.h:85
FromTextOp(std::string text)
Definition: public_ops.h:384
IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, int val)
IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, double val)
IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, float val)
IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, blace::ops::OpP val)
Definition: public_ops.h:150
InferenceOp(std::vector< char > model_bytes, std::vector< OpP > inputs, ml_core::InferenceArgsCollection inference_args, int return_index, std::string payload_folder)
InferenceOp(InferenceOp const &e)
Definition: public_ops.h:52
Interpolate2DOp(OpP node, int height, int width, ml_core::Interpolation interpolation, bool align_corners, bool antialias)
Definition: public_ops.h:181
MapToRangeOp(OpP input, ml_core::ValueRangeEnum range)
Definition: public_ops.h:429
Definition: public_ops.h:72
Definition: public_ops.h:197
NormalizeToZeroOneOP(NormalizeToZeroOneOP const &e)
NormalizeToZeroOneOP(OpP input, OpP min_in, OpP max_in, double min_out, double max_out)
NormalizeToZeroOneOP(OpP input, double min_in, double max_in, OpP min_out, OpP max_out)
NormalizeToZeroOneOP(OpP input, double min_in, double max_in, double min_out, double max_out)
NormalizeToZeroOneOP(OpP input, double min, double max)
Definition: public_ops.h:362
OnesOp(std::vector< int64_t > sizes, ml_core::OrderEnum order, ml_core::DeviceEnum device, ml_core::DataTypeEnum data_type, ml_core::ColorFormatEnum color_format)
Definition: public_ops.h:306
PrepareForHostCopyOP(OpP input, ml_core::DataTypeEnum data_type, ml_core::ColorFormatEnum color_format, ml_core::OrderEnum tensor_order, ml_core::ValueRangeEnum value_range, ml_core::DeviceEnum device)
Definition: public_ops.h:263
ToColorOp(OpP input, ml_core::ColorFormatEnum color_format, ml_core::LAB_NORMS lab_norms)
ToColorOp(OpP input, ml_core::ColorFormatEnum color_format)
Definition: public_ops.h:333
ZerosOp(ZerosOp const &e)
ZerosOp(std::vector< int64_t > sizes, ml_core::OrderEnum order, ml_core::DeviceEnum device, ml_core::DataTypeEnum data_type, ml_core::ColorFormatEnum color_format)
Contains implementation for a class used to I/O custom memory.
Definition: types.h:129
Basic types of the blace.ai library.
DataTypeEnum
Definition: types.h:59
Interpolation
Definition: types.h:160
OrderEnum
Definition: types.h:74
ColorFormatEnum
Definition: types.h:103
DeviceEnum
Definition: types.h:41
ValueRangeEnum
Definition: types.h:46