summaryrefslogtreecommitdiff
path: root/ggml.c
diff options
context:
space:
mode:
authorTimothy Cronin <40186632+4imothy@users.noreply.github.com>2024-01-11 02:27:48 -0500
committerGeorgi Gerganov <ggerganov@gmail.com>2024-01-11 09:39:05 +0200
commitf85a973aa139ae6f37e8b8e1966f1d278b5e0372 (patch)
treee8ea5b9f6452de3791277b76779a6589a514bbe2 /ggml.c
parent5362e43962e84d61e20b91f34991d7ccaef4a7d5 (diff)
ggml : remove ggml_cpy_inplace and ggml_cont_inplace (ggml/693)
Diffstat (limited to 'ggml.c')
-rw-r--r--ggml.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/ggml.c b/ggml.c
index 4a0ec4c4..9c42a45e 100644
--- a/ggml.c
+++ b/ggml.c
@@ -4311,13 +4311,13 @@ struct ggml_tensor * ggml_set_2d_inplace(
static struct ggml_tensor * ggml_cpy_impl(
struct ggml_context * ctx,
struct ggml_tensor * a,
- struct ggml_tensor * b,
- bool inplace) {
+ struct ggml_tensor * b) {
GGML_ASSERT(ggml_nelements(a) == ggml_nelements(b));
bool is_node = false;
- if (!inplace && (a->grad || b->grad)) {
+ if (a->grad || b->grad) {
+ // inplace is false and either one have a grad
is_node = true;
}
@@ -4341,29 +4341,21 @@ struct ggml_tensor * ggml_cpy(
struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b) {
- return ggml_cpy_impl(ctx, a, b, false);
-}
-
-struct ggml_tensor * ggml_cpy_inplace(
- struct ggml_context * ctx,
- struct ggml_tensor * a,
- struct ggml_tensor * b) {
- return ggml_cpy_impl(ctx, a, b, true);
+ return ggml_cpy_impl(ctx, a, b);
}
// ggml_cont
static struct ggml_tensor * ggml_cont_impl(
struct ggml_context * ctx,
- struct ggml_tensor * a,
- bool inplace) {
+ struct ggml_tensor * a) {
bool is_node = false;
- if (!inplace && a->grad) {
+ if (a->grad) {
is_node = true;
}
- struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
+ struct ggml_tensor * result = ggml_dup_tensor(ctx, a);
ggml_format_name(result, "%s (cont)", a->name);
result->op = GGML_OP_CONT;
@@ -4376,13 +4368,7 @@ static struct ggml_tensor * ggml_cont_impl(
struct ggml_tensor * ggml_cont(
struct ggml_context * ctx,
struct ggml_tensor * a) {
- return ggml_cont_impl(ctx, a, false);
-}
-
-struct ggml_tensor * ggml_cont_inplace(
- struct ggml_context * ctx,
- struct ggml_tensor * a) {
- return ggml_cont_impl(ctx, a, true);
+ return ggml_cont_impl(ctx, a);
}
// make contiguous, with new shape