blace.ai
Loading...
Searching...
No Matches
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 FromRawMemoryFetcherOp : public BaseOp {
307
308public:
317 FromRawMemoryFetcherOp(std::shared_ptr<blace::RawMemoryFetcher> mem_fetcher,
318 ml_core::DeviceEnum device);
319};
320
324class EXPORT_OR_IMPORT PrepareForHostCopyOP : public BaseOp {
325
326public:
342 ml_core::ColorFormatEnum color_format,
343 ml_core::OrderEnum tensor_order,
344 ml_core::ValueRangeEnum value_range,
345 ml_core::DeviceEnum device);
346};
347
351class EXPORT_OR_IMPORT ZerosOp : public BaseOp {
352
353public:
365 ZerosOp(std::vector<int64_t> sizes, ml_core::OrderEnum order,
367 ml_core::ColorFormatEnum color_format);
373 ZerosOp(ZerosOp const &e);
374 ~ZerosOp();
375};
376
380class EXPORT_OR_IMPORT OnesOp : public BaseOp {
381
382public:
394 OnesOp(std::vector<int64_t> sizes, ml_core::OrderEnum order,
396 ml_core::ColorFormatEnum color_format);
397};
398
402class EXPORT_OR_IMPORT IndexPutOp : public BaseOp {
403
404public:
413 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices,
414 blace::ops::OpP val);
423 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, double val);
432 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, float val);
441 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, int val);
442};
443
447class EXPORT_OR_IMPORT NoneOp : public BaseOp {
448
449public:
455};
456
460class EXPORT_OR_IMPORT SaveImageOp : public BaseOp {
461
462public:
470 SaveImageOp(blace::ops::OpP input, std::string filename);
471};
472
476class EXPORT_OR_IMPORT IndexOp : public BaseOp {
477public:
485 IndexOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices,
486 std::optional<ml_core::ColorFormatEnum> color_format = std::nullopt);
487};
488
493class EXPORT_OR_IMPORT DrawRectangles : public BaseOp {
494
495public:
506 DrawRectangles(blace::ops::OpP img, blace::ops::OpP bounding_boxes, int r,
507 int g, int b, int thickness);
508};
509
510} // namespace ops
511} // namespace blace
Definition public_ops.h:493
DrawRectangles(blace::ops::OpP img, blace::ops::OpP bounding_boxes, int r, int g, int b, int thickness)
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:306
FromRawMemoryFetcherOp(std::shared_ptr< blace::RawMemoryFetcher > mem_fetcher, ml_core::DeviceEnum device)
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:476
IndexOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, std::optional< ml_core::ColorFormatEnum > color_format=std::nullopt)
Definition public_ops.h:402
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:447
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:380
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:324
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:460
SaveImageOp(blace::ops::OpP input, std::string filename)
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:351
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