Skip to content

Commit 319c6cb

Browse files
authored
duplicate shape of source
1 parent 92943e7 commit 319c6cb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ggml/src/ggml.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,8 @@ struct ggml_tensor * ggml_reglu(
26262626
struct ggml_tensor * a) {
26272627
GGML_ASSERT(ggml_is_contiguous_1(a));
26282628

2629-
struct ggml_tensor * result = ggml_new_tensor_2d(ctx, a->type, a->ne[0] / 2, a->ne[1]);
2629+
int64_t ne[GGML_MAX_DIMS] = { a->ne[0] / 2 }; for (int i = 1; i < GGML_MAX_DIMS; i++) ne[i] = a->ne[i];
2630+
struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, GGML_MAX_DIMS, ne, NULL, 0);
26302631

26312632
ggml_set_op_params_i32(result, 0, (int32_t) GGML_UNARY_OP_REGLU);
26322633

@@ -2643,7 +2644,8 @@ struct ggml_tensor * ggml_geglu(
26432644
struct ggml_tensor * a) {
26442645
GGML_ASSERT(ggml_is_contiguous_1(a));
26452646

2646-
struct ggml_tensor * result = ggml_new_tensor_2d(ctx, a->type, a->ne[0] / 2, a->ne[1]);
2647+
int64_t ne[GGML_MAX_DIMS] = { a->ne[0] / 2 }; for (int i = 1; i < GGML_MAX_DIMS; i++) ne[i] = a->ne[i];
2648+
struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, GGML_MAX_DIMS, ne, NULL, 0);
26472649

26482650
ggml_set_op_params_i32(result, 0, (int32_t) GGML_UNARY_OP_GEGLU);
26492651

@@ -2660,7 +2662,8 @@ struct ggml_tensor * ggml_swiglu(
26602662
struct ggml_tensor * a) {
26612663
GGML_ASSERT(ggml_is_contiguous_1(a));
26622664

2663-
struct ggml_tensor * result = ggml_new_tensor_2d(ctx, a->type, a->ne[0] / 2, a->ne[1]);
2665+
int64_t ne[GGML_MAX_DIMS] = { a->ne[0] / 2 }; for (int i = 1; i < GGML_MAX_DIMS; i++) ne[i] = a->ne[i];
2666+
struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, GGML_MAX_DIMS, ne, NULL, 0);
26642667

26652668
ggml_set_op_params_i32(result, 0, (int32_t) GGML_UNARY_OP_SWIGLU);
26662669

0 commit comments

Comments
 (0)