interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / src / ggml-openvino / openvino / op / clamp.cpp

33 lines · 931 bytes Raw Blame History
1#include "../node_context.h"
2#include "../op_table.h"
3#include "../utils.h"
4
5#include <cstring>
6#include <openvino/op/clamp.hpp>
7
8namespace ov {
9namespace frontend {
10namespace ggml {
11namespace op {
12
13OutputVector translate_clamp(const NodeContext & context) {
14 num_inputs_check(context, 1, 1);
15
16 auto input = process_view_input_new(context, 0);
17
18 const int32_t * op_params = context.get_output_op_params();
19 FRONT_END_CHECK_IMPLEMENTED(op_params != nullptr, "CLAMP requires output op params");
20
21 float min;
22 float max;
23 std::memcpy(&min, reinterpret_cast<const float *>(op_params) + 0, sizeof(float));
24 std::memcpy(&max, reinterpret_cast<const float *>(op_params) + 1, sizeof(float));
25
26 auto res = std::make_shared<ov::op::v0::Clamp>(input, min, max);
27 return rename_outputs_with_suffix({res}, context.get_name());
28}
29
30} // namespace op
31} // namespace ggml
32} // namespace frontend
33} // namespace ov