MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / ggml_clamp

Function ggml_clamp

subprojects/llama.cpp/ggml/src/ggml.c:4315–4330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4313// ggml_clamp
4314
4315struct ggml_tensor * ggml_clamp(
4316 struct ggml_context * ctx,
4317 struct ggml_tensor * a,
4318 float min,
4319 float max) {
4320 // TODO: when implement backward, fix this:
4321 struct ggml_tensor * result = ggml_view_tensor(ctx, a);
4322
4323 float params[] = { min, max };
4324 ggml_set_op_params(result, params, sizeof(params));
4325
4326 result->op = GGML_OP_CLAMP;
4327 result->src[0] = a;
4328
4329 return result;
4330}
4331
4332static int64_t ggml_calc_conv_output_size(int64_t ins, int64_t ks, int s, int p, int d) {
4333 return (ins + 2 * p - d * (ks - 1) - 1) / s + 1;

Callers 10

build_moe_ffnMethod · 0.85
llm_build_dbrxMethod · 0.85
llm_build_olmoMethod · 0.85
llm_build_mptMethod · 0.85
llm_build_chameleonMethod · 0.85
build_graphMethod · 0.85
build_graphMethod · 0.85
ggml_vk_check_results_0Function · 0.85

Calls 2

ggml_view_tensorFunction · 0.85
ggml_set_op_paramsFunction · 0.85

Tested by 2

build_graphMethod · 0.68
build_graphMethod · 0.68