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"
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:
164 InferenceOp(std::vector<char> model_bytes, std::vector<OpP> inputs,
165 ml_core::InferenceArgsCollection inference_args, int return_index,
166 std::string payload_folder,
167 std::optional<std::string> payload_url = std::nullopt);
168
175 ~InferenceOp();
176};
177
183class EXPORT_OR_IMPORT MapToRangeOp : public BaseOp {
184
185public:
193};
194
199class EXPORT_OR_IMPORT NormalizeToZeroOneOP : public BaseOp {
200
201public:
208
216 NormalizeToZeroOneOP(OpP input, double min, double max);
217
227 NormalizeToZeroOneOP(OpP input, OpP min_in, OpP max_in, double min_out,
228 double max_out);
229
239 NormalizeToZeroOneOP(OpP input, double min_in, double max_in, double min_out,
240 double max_out);
241
251 NormalizeToZeroOneOP(OpP input, double min_in, double max_in, OpP min_out,
252 OpP max_out);
260};
261
265class EXPORT_OR_IMPORT ToColorOp : public BaseOp {
266
267public:
275 ToColorOp(OpP input, ml_core::ColorFormatEnum color_format);
276
285 ToColorOp(OpP input, ml_core::ColorFormatEnum color_format,
286 ml_core::LAB_NORMS lab_norms);
287};
288
292class EXPORT_OR_IMPORT FromRawMemoryOp : public BaseOp {
293
294public:
302 FromRawMemoryOp(std::shared_ptr<blace::RawMemoryObject> mem_object);
303};
304
308class EXPORT_OR_IMPORT FromRawMemoryFetcherOp : public BaseOp {
309
310public:
319 FromRawMemoryFetcherOp(std::shared_ptr<blace::RawMemoryFetcher> mem_fetcher,
320 ml_core::DeviceEnum device);
321};
322
326class EXPORT_OR_IMPORT PrepareForHostCopyOP : public BaseOp {
327
328public:
344 ml_core::ColorFormatEnum color_format,
345 ml_core::OrderEnum tensor_order,
346 ml_core::ValueRangeEnum value_range,
347 ml_core::DeviceEnum device);
348};
349
353class EXPORT_OR_IMPORT ZerosOp : public BaseOp {
354
355public:
367 ZerosOp(std::vector<int64_t> sizes, ml_core::OrderEnum order,
369 ml_core::ColorFormatEnum color_format);
375 ZerosOp(ZerosOp const &e);
376 ~ZerosOp();
377};
378
382class EXPORT_OR_IMPORT OnesOp : public BaseOp {
383
384public:
396 OnesOp(std::vector<int64_t> sizes, ml_core::OrderEnum order,
398 ml_core::ColorFormatEnum color_format);
399};
400
404class EXPORT_OR_IMPORT IndexPutOp : public BaseOp {
405
406public:
415 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices,
416 blace::ops::OpP val);
425 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, double val);
434 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, float val);
443 IndexPutOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, int val);
444};
445
449class EXPORT_OR_IMPORT NoneOp : public BaseOp {
450
451public:
457};
458
462class EXPORT_OR_IMPORT SaveImageOp : public BaseOp {
463
464public:
472 SaveImageOp(blace::ops::OpP input, std::string filename);
473};
474
478class EXPORT_OR_IMPORT SaveAudioFileOp : public BaseOp {
479
480public:
488 SaveAudioFileOp(blace::ops::OpP input, std::string filename);
489};
490
494class EXPORT_OR_IMPORT IndexOp : public BaseOp {
495public:
503 IndexOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices,
504 std::optional<ml_core::ColorFormatEnum> color_format = std::nullopt);
505};
506
511class EXPORT_OR_IMPORT DrawRectangles : public BaseOp {
512
513public:
524 DrawRectangles(blace::ops::OpP img, blace::ops::OpP bounding_boxes, int r,
525 int g, int b, int thickness);
526};
527
531class EXPORT_OR_IMPORT AddOp : public BaseOp {
532public:
539 AddOp(blace::ops::OpP a, blace::ops::OpP b);
546 AddOp(blace::ops::OpP a, double b);
554 AddOp(blace::ops::OpP a, double b, ml_core::ValueRangeEnum norm);
555};
556
560class EXPORT_OR_IMPORT SubOp : public BaseOp {
561public:
568 SubOp(blace::ops::OpP a, blace::ops::OpP b);
569};
570
574class EXPORT_OR_IMPORT SumOp : public BaseOp {
575
576public:
584 SumOp(blace::ops::OpP input, std::vector<int64_t> sizes, bool keepdim);
585};
586
587} // namespace ops
588} // namespace blace
Definition public_ops.h:531
AddOp(blace::ops::OpP a, blace::ops::OpP b)
AddOp(blace::ops::OpP a, double b, ml_core::ValueRangeEnum norm)
AddOp(blace::ops::OpP a, double b)
Definition public_ops.h:511
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:308
FromRawMemoryFetcherOp(std::shared_ptr< blace::RawMemoryFetcher > mem_fetcher, ml_core::DeviceEnum device)
Definition public_ops.h:292
FromRawMemoryOp(std::shared_ptr< blace::RawMemoryObject > mem_object)
Definition public_ops.h:85
FromTextOp(std::string text)
Definition public_ops.h:494
IndexOp(blace::ops::OpP input, ml_core::BlaceIndexVec indices, std::optional< ml_core::ColorFormatEnum > color_format=std::nullopt)
Definition public_ops.h:404
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, std::optional< std::string > payload_url=std::nullopt)
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:183
MapToRangeOp(OpP input, ml_core::ValueRangeEnum range)
Definition public_ops.h:449
Definition public_ops.h:72
Definition public_ops.h:199
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:382
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:326
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:478
SaveAudioFileOp(blace::ops::OpP input, std::string filename)
Definition public_ops.h:462
SaveImageOp(blace::ops::OpP input, std::string filename)
Definition public_ops.h:560
SubOp(blace::ops::OpP a, blace::ops::OpP b)
Definition public_ops.h:574
SumOp(blace::ops::OpP input, std::vector< int64_t > sizes, bool keepdim)
Definition public_ops.h:265
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:353
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 lazily.
Contains implementation for a class used to I/O custom memory.
Definition types.h:131
Basic types of the blace.ai library.
DataTypeEnum
Definition types.h:59
Interpolation
Definition types.h:162
OrderEnum
Definition types.h:74
ColorFormatEnum
Definition types.h:105
DeviceEnum
Definition types.h:41
ValueRangeEnum
Definition types.h:46