@@ -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