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

Function ggml_add_cast_impl

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

Source from the content-addressed store, hash-verified

1985// ggml_add_cast
1986
1987static struct ggml_tensor * ggml_add_cast_impl(
1988 struct ggml_context * ctx,
1989 struct ggml_tensor * a,
1990 struct ggml_tensor * b,
1991 enum ggml_type type) {
1992 // TODO: support less-strict constraint
1993 // GGML_ASSERT(ggml_can_repeat(b, a));
1994 GGML_ASSERT(ggml_can_repeat_rows(b, a));
1995
1996 // currently only supported for quantized input and f16
1997 GGML_ASSERT(ggml_is_quantized(a->type) ||
1998 a->type == GGML_TYPE_F16 ||
1999 a->type == GGML_TYPE_BF16);
2000
2001 struct ggml_tensor * result = ggml_new_tensor(ctx, type, GGML_MAX_DIMS, a->ne);
2002
2003 result->op = GGML_OP_ADD;
2004 result->src[0] = a;
2005 result->src[1] = b;
2006
2007 return result;
2008}
2009
2010struct ggml_tensor * ggml_add_cast(
2011 struct ggml_context * ctx,

Callers 1

ggml_add_castFunction · 0.85

Calls 3

ggml_can_repeat_rowsFunction · 0.85
ggml_is_quantizedFunction · 0.85
ggml_new_tensorFunction · 0.85

Tested by

no test coverage detected